結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー cureskolcureskol
提出日時 2020-03-20 23:10:29
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 809 bytes
コンパイル時間 1,433 ms
コンパイル使用メモリ 165,068 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-21 19:11:40
合計ジャッジ時間 2,687 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,376 KB
testcase_20 AC 1 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef pair<int,int> P;
bool cmp(P a,P b){
  return a.first*b.second>a.second*b.first;
}

signed main(){
  int y,m,d;char c;cin>>y>>c>>m>>c>>d;
  d+=2;
  if(m==4||m==6||m==9||m==11){
    if(d>30){
      d-=30;
      m++;
    }
  }
  else if(m==2){
    if(y%4==0){
      if(y%100==0){
        if(y%400==0){
          if(d>29){
            d-=29;
            m++;
          }
        }
        else{
          if(d>28){
            d-=28;m++;
          }
        }
      }
      else{
        if(d>29){
          d-=29;
          m++;
        }
      }
    }
    else{
      if(d>28){
        d-=28;m++;
      }
    }
  }
  else{
    if(d>31){
      d-=31;m++;
    }
  }
  if(m>12)m=1,y++;
  cout<<y<<c;if(m<10)cout<<0;cout<<m<<c;if(d<10)cout<<0;cout<<d<<endl;
}
0