結果

問題 No.3402 [Cherry Anniversary 5] Beyond Zelkova, the 5th year vista seen through the bloom of a cherry bloosom
コンテスト
ユーザー pengin_2000
提出日時 2025-12-13 03:36:18
言語 C
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 876 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 463 ms
コンパイル使用メモリ 27,340 KB
実行使用メモリ 7,852 KB
最終ジャッジ日時 2025-12-13 03:36:20
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 16 WA * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:34:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   34 |         scanf("%d %d %d", &ys, &ms, &ds);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:36:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   36 |         scanf("%d %d %d", &ye, &me, &de);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:38:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |         scanf("%d", &q);
      |         ^~~~~~~~~~~~~~~
main.c:44:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   44 |                 scanf("%d %d %d", &y, &m, &d);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include<stdio.h>
int is_leap(int n)
{
	if (n % 400 == 0)
		return 1;
	else if (n % 100 == 0)
		return -1;
	else if (n % 4 == 0)
		return 1;
	else
		return -1;
}
int md[12] = { 31,28,31,30,31,30,31,31,30,31,30,31 };
int cal(int y, int m, int d)
{
	int res = 0;
	y--;
	res += 365 * y;
	res += y / 4;
	res -= y / 100;
	res += y / 400;
	y++;
	int i;
	for (i = 0; i < m; i++)
		res += md[i];
	if (is_leap(y) > 0 && m > 2)
		res++;
	res += d;
	return res;
}
int main()
{
	int ys, ms, ds;
	scanf("%d %d %d", &ys, &ms, &ds);
	int ye, me, de;
	scanf("%d %d %d", &ye, &me, &de);
	int q;
	scanf("%d", &q);
	int y, m, d;
	int a, b;
	b = cal(ye, me, de) - cal(ys, ms, ds) + 1;
	for (; q > 0; q--)
	{
		scanf("%d %d %d", &y, &m, &d);
		a = cal(y, m, d) - cal(ye, me, de);
		if (a < b)
			printf("Less\n");
		else if (a == b)
			printf("Same\n");
		else
			printf("More\n");
	}
	return 0;
}
0