結果

問題 No.8083 12歳
ユーザー kotatsugame
提出日時 2021-04-01 22:11:49
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 621 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 65,608 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-12-21 06:30:26
合計ジャッジ時間 9,319 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 366
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
using namespace std;
bool isr(int Y){return Y%4?false:Y%100?true:Y%400?false:true;}
main()
{
	int Y,N,D;
	cin>>Y>>N>>D;
	if(isr(Y+1))
	{//334 -> in 2/29
		if(isr(Y-12))
		{
		}
		else
		{
			if(D<=333)cout<<N-min(N,D);
			else cout<<N-min(N,D-1);
			cout<<" ";
			if(D<=333)cout<<min(N,365-D)<<endl;
			else cout<<min(N,366-D)<<endl;
		}
	}
	else
	{//333 -> in 2/28
		if(isr(Y-12))
		{
			if(D<=333)cout<<N-min(N,D);
			else cout<<N-min(N,D+1);
			cout<<" ";
			if(D<=333)cout<<min(N,366-D)<<endl;
			else cout<<min(N,365-D)<<endl;
		}
		else
		{
			cout<<N-min(N,D)<<" "<<min(N,365-D)<<endl;
		}
	}
}
0