結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー okok
提出日時 2018-09-04 20:07:34
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 1,644 ms
コンパイル使用メモリ 160,272 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 15:21:42
合計ジャッジ時間 2,281 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

int main(){
  string S;
  int y, m, d, XX =28;

  cin>>S;
  d = (S[8]-'0')*10 + S[9]-'0';
  m = (S[5]-'0')*10 + S[6]-'0';
  y = (S[0]-'0')*1000 + (S[1]-'0')*100+(S[2]-'0')*10 + S[3]-'0';
  d += 2;

  if(y%400 == 0 || (y%4==0 && y%100 != 0)) XX = 29;
  if(m == 2){
    if(d > XX)m++, d = d-XX;
  } else if(m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10){
    if(d > 31)m++, d = d-31;
  } else if(m == 12){
    if(d > 31)y++, m = 1,d = d-31;
  } else {
    if(d > 30)m++, d = d-30;
  }

  cout<<'2'<<(char)((y%1000)/100 + '0')<<(char)((y%100)/10 + '0')<<(char)(y%10 + '0')<<'/';
  cout<<(char)(m/10 + '0')<<(char)(m%10 + '0')<<'/'<<(char)(d/10 + '0')<<(char)(d%10 + '0')<<endl;
  return 0;
}
0