結果
| 問題 | 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:46:15 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 900 bytes |
| 記録 | |
| コンパイル時間 | 186 ms |
| コンパイル使用メモリ | 27,340 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-13 03:46:20 |
| 合計ジャッジ時間 | 1,342 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 16 WA * 8 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:37:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
37 | scanf("%d %d %d", &ys, &ms, &ds);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:39:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
39 | scanf("%d %d %d", &ye, &me, &de);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:41:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
41 | scanf("%d", &q);
| ^~~~~~~~~~~~~~~
main.c:47:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | scanf("%d %d %d", &y, &m, &d);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#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;
if (y > 1)
{
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;
}
pengin_2000