結果

問題 No.721 Die tertia (ディエ・テルツィア)
ユーザー YamaKasaYamaKasa
提出日時 2018-08-03 22:39:30
言語 Java19
(openjdk 21)
結果
AC  
実行時間 230 ms / 2,000 ms
コード長 836 bytes
コンパイル時間 4,162 ms
コンパイル使用メモリ 75,300 KB
実行使用メモリ 58,708 KB
最終ジャッジ日時 2023-10-19 21:30:39
合計ジャッジ時間 9,834 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 228 ms
57,640 KB
testcase_01 AC 226 ms
57,640 KB
testcase_02 AC 226 ms
58,244 KB
testcase_03 AC 223 ms
58,296 KB
testcase_04 AC 212 ms
58,272 KB
testcase_05 AC 228 ms
58,276 KB
testcase_06 AC 225 ms
58,252 KB
testcase_07 AC 230 ms
58,616 KB
testcase_08 AC 224 ms
58,256 KB
testcase_09 AC 222 ms
58,708 KB
testcase_10 AC 213 ms
58,196 KB
testcase_11 AC 229 ms
58,336 KB
testcase_12 AC 216 ms
57,728 KB
testcase_13 AC 214 ms
57,724 KB
testcase_14 AC 229 ms
58,260 KB
testcase_15 AC 226 ms
58,232 KB
testcase_16 AC 224 ms
58,324 KB
testcase_17 AC 213 ms
58,336 KB
testcase_18 AC 225 ms
58,316 KB
testcase_19 AC 223 ms
58,224 KB
testcase_20 AC 224 ms
58,280 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		 Calendar calendar = Calendar.getInstance();
		 Scanner scan = new Scanner(System.in);
		 String s = scan.next();
		 scan.close();
		 int year = Integer.parseInt(s.substring(0, 4));
		 String month = s.substring(5, 7);
		 String day = s.substring(8, 10);

		 if(month.charAt(0) == '0'){
			 month = month.substring(1, 2);
		 }
		 if(day.charAt(0) == '0'){
			 day = day.substring(1, 2);
		 }

		 SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd");
		 calendar.set(year, Integer.parseInt(month) - 1, Integer.parseInt(day));
		 //System.out.println(sdf.format(calendar.getTime()));
		 calendar.add(Calendar.DATE, 2);

		 System.out.println(sdf.format(calendar.getTime()));

	}
}
0