結果
| 問題 |
No.721 Die tertia (ディエ・テルツィア)
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2023-11-16 20:11:41 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 742 bytes |
| コンパイル時間 | 858 ms |
| コンパイル使用メモリ | 21,248 KB |
| 実行使用メモリ | 6,940 KB |
| 最終ジャッジ日時 | 2024-09-26 05:14:40 |
| 合計ジャッジ時間 | 862 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 15 WA * 3 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:13:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
13 | scanf("%s", s);
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<stdlib.h>
#include<time.h>
int main(void){
char s[20], s1[20];
int year, mon, day;
int i;
struct tm nntm = { 0, 0, 0, 1, 1, 2000 };
time_t nnt;
scanf("%s", s);
//printf("%s\n", s);
s1[0] = s[0];
s1[1] = s[1];
s1[2] = s[2];
s1[3] = s[3];
s1[4] = 0;
year = atoi(s1);
s1[0] = s[5];
s1[1] = s[6];
s1[2] = 0;
mon = atoi(s1);
s1[0] = s[8];
s1[1] = s[9];
s1[2] = 0;
day = atoi(s1);
if((year == 2000 || year == 2400) && mon == 2){
printf("%d/%02d/%02d\n", year, mon, day + 2);
}
else {
nntm.tm_year = year;
nntm.tm_mon = mon - 1;
nntm.tm_mday = day + 2;
nnt = mktime(&nntm);
printf("%d/%02d/%02d\n", nntm.tm_year, nntm.tm_mon + 1, nntm.tm_mday);
}
return 0;
}
suppy193