AtCoder Grand Contest 008

Submission #1575653

Source codeソースコード

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
 
#define BIG 2000000007
 
#define MOD 1000000007
typedef unsigned long long ull;
typedef   signed long long sll;
 
typedef struct {
	ull above;
	ull below;
	int index;
} hw;
 
#define N_MAX 100000
#define M_MAX 100000
 
ull n, m, k;
ull h, w;
// ull a[N_MAX];
// ull b[N_MAX];
// ull dp[N_MAX][M_MAX + 1];
char s[N_MAX + 1];
char t[N_MAX + 1];
 
void swap_adj(ull *a, ull *b){
	ull tmp = *b;
	*b = *a;
	*a = tmp;
	return;
}
 
int comp(const void *a, const void *b){
	if (*(ull*)a > *(ull*)b) {
		return -1;
	} else if (*(ull*)a < *(ull*)b) {
		return +1;
	} else {
		return 0;
	}
}
 
ull divide(ull a, ull b){
	ull x = MOD - 2;
	ull ans = 1;
	while (x) {
		if (x & 1) ans = (ans * b) % MOD;
		b = (b * b) % MOD;
		x /= 2;
	}
	return (a * ans) % MOD;
}
 
int digits(ull x){
	int i = 1;
	while (x >= 10) {
		x /= 10;
		i++;
	}
	return i;
}
 
int min(ull x, ull y){
	return (x < y) ? x : y;
}
 
ull gcd(ull x, ull y){
	if (x < y) {
		return gcd(y, x);
	} else if (y == 0) {
		return x;
	} else {
		return gcd(y, x % y);
	}
}
 
ull bitpow(ull a, ull x){
	ull result = 1;
	while (x) {
		if (x & 1) {
			result *= a;
			result %= MOD;
		}
		x /= 2;
		a = (a * a) % MOD;
	}
	return result;
}
 
ull solve(){
	int i, j;
	const size_t len = strlen(t);
 
	for (i = 0; i < len; i++) {
		if (t[i] != s[0]) continue;
		for (j = 1; i + (k - 1) * j <= len - 1; j++) {
			int seeki;
			for (seeki = 1; seeki < k; seeki++) {
				if (t[i + seeki * j] != s[seeki]) break;
			}
			if (seeki == k) return 1;
		}
	}
 
	return 0;
}
 
int main(void){
	int i, j, k;
	int x = 0;
 
	scanf("%d%d", &i, &j);

	if (i <= j) {
		x = (j - i);
		if (i < 0 && j > 0) {
			x += 1;
		}
	} else {
		if (i >= 0 && j <= 0) {
			x = (i + j) + 1;
		} else {
			x = (i - j) + 2;
		}
	}
	printf("%d\n", x);

	// solve();
 
	return 0;
}

Submission

Task問題 A - Simple Calculator
User nameユーザ名 sheyasutaka
Created time投稿日時
Language言語 C (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 2003 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.c: In function ‘main’:
./Main.c:115:2: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%d%d", &i, &j);
^

Test case

Set

Set name Score得点 / Max score Cases
Sample - 0_00.txt,0_01.txt,0_02.txt
All 0 / 300 0_00.txt,0_01.txt,0_02.txt,1_00.txt,1_01.txt,1_02.txt,1_03.txt,1_04.txt,1_05.txt,1_06.txt,1_07.txt,1_08.txt,1_09.txt,1_10.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
0_00.txt AC
0_01.txt AC
0_02.txt AC
1_00.txt WA
1_01.txt AC
1_02.txt WA
1_03.txt AC
1_04.txt AC
1_05.txt AC
1_06.txt WA
1_07.txt AC
1_08.txt WA
1_09.txt WA
1_10.txt AC