結果
| 問題 |
No.721 Die tertia (ディエ・テルツィア)
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2019-02-19 17:32:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 860 bytes |
| コンパイル時間 | 1,581 ms |
| コンパイル使用メモリ | 159,948 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-12 10:19:43 |
| 合計ジャッジ時間 | 2,057 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 18 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%d/%d/%d",&y,&m,&d);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~
ソースコード
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
int gcd(int a,int b){return b?gcd(b,a%b):a;}
void daypls(int& y,int& m,int& d) {
d+=2;
if ((m<=7&&m%2==1)||(m>=8&&m%2==0)) {//31days
m+=d>31?1:0;
d--;d%=31;d++;
y+=m>12?1:0;
m%=12;
} else if (m!=2) {
m+=d>30?1:0;
d--;d%=30;d++;
} else {
if (y%400==0||(y%100!=0&&y%4==0)) {
m+=d>29?1:0;
d--;d%=29;d++;
} else {
m+=d>28?1:0;
d--;d%=28;d++;
}
}
}
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int y,m,d;
scanf("%d/%d/%d",&y,&m,&d);
daypls(y,m,d);
cout <<y<<'/';
if (m/10<1) cout << 0;
cout << m << '/';
if (d/10<1) cout << 0;
cout << d << endl;
return 0;
}
🍮かんプリン