Submission #1575653


Source Code Expand

#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 Info

Submission Time
Task A - Simple Calculator
User sheyasutaka
Language C (GCC 5.4.1)
Score 0
Code Size 2003 Byte
Status WA
Exec Time 1 ms
Memory 128 KB

Compile Error

./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);
  ^

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 3
AC × 9
WA × 5
Set Name Test Cases
Sample 0_00.txt, 0_01.txt, 0_02.txt
All 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
Case Name Status Exec Time Memory
0_00.txt AC 0 ms 128 KB
0_01.txt AC 0 ms 128 KB
0_02.txt AC 0 ms 128 KB
1_00.txt WA 0 ms 128 KB
1_01.txt AC 0 ms 128 KB
1_02.txt WA 0 ms 128 KB
1_03.txt AC 0 ms 128 KB
1_04.txt AC 0 ms 128 KB
1_05.txt AC 0 ms 128 KB
1_06.txt WA 1 ms 128 KB
1_07.txt AC 0 ms 128 KB
1_08.txt WA 0 ms 128 KB
1_09.txt WA 0 ms 128 KB
1_10.txt AC 0 ms 128 KB