結果
問題 |
No.721 Die tertia (ディエ・テルツィア)
|
ユーザー |
|
提出日時 | 2018-09-21 16:38:21 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 25 ms / 2,000 ms |
コード長 | 1,222 bytes |
コンパイル時間 | 477 ms |
コンパイル使用メモリ | 72,948 KB |
最終ジャッジ日時 | 2025-01-06 13:39:39 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:26:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 26 | scanf("%d/%d/%d",&y,&m,&d); | ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<vector> #include<iostream> #include<stdio.h> #include<string> #include<utility> #include<algorithm> #define loop while(1) #define SZ(x) ((int)(x).size()) #define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define pushb push_back #define popb pop_back #define VI vector<int> #define VVI vector<VI> typedef long long int ll; using namespace std; const int mon1[7]={1,3,5,7,8,10,12}; const int mon2[4]={4,6,9,11}; int main() { int y,m,d; scanf("%d/%d/%d",&y,&m,&d); d+=2; REP(i,7){ if(mon1[i]==m){ if(d>31){ d %=31; m++; } } } REP(i,4){ if(mon2[i]==m){ if(d>30){ d %=30; m++; } } } if((y%4==0)^(y%100 ==0)^(y%400 ==0)){ if(m==2){ if(d>29){ d %= 29; m++; } } }else{ if(m==2){ if(d>28){ d %= 28; m++; } } } if(m >12){ y++; m %=12; } printf("%04d/%02d/%02d",y,m,d); return 0; }