結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー chocoruskchocorusk
提出日時 2018-08-03 23:04:41
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 873 bytes
コンパイル時間 1,371 ms
コンパイル使用メモリ 78,688 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-19 21:37:34
合計ジャッジ時間 1,595 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 2 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   21 |         scanf("%d/%d/%d", &y, &m, &d);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int y, m, d;
	scanf("%d/%d/%d", &y, &m, &d);
	bool e=0;
	if(y%4==0 && y%100!=0){
		e=1;
	}else if(y%400==0){
		e=1;
	}
	int dmax[13];
	for(int i=1; i<=12; i++){
		if(i==2 && e){
			dmax[i]=29;
		}else if(i==2 && !e){
			dmax[i]=28;
		}else if(i==4 || i==6 || i==9 || i==11){
			dmax[i]=30;
		}else{
			dmax[i]=31;
		}
	}
	int y1, m1, d1;
	if(d+2<=dmax[m]){
		y1=y, m1=m, d1=d+2;
	}else{
		y1=y, m1=m+1, d1=d+2-dmax[m];
		if(m1==13){
			m1=1;
			y1++;
		}
	}
	cout<<y1<<"/";
	if(m1<10){
		cout<<0;
	}
	cout<<m1<<"/";
	if(d1<10){
		cout<<0;
	}
	cout<<d1<<endl;
	return 0;
}
0