結果

問題 No.682 Average
ユーザー sudo_yumsudo_yum
提出日時 2018-06-06 14:08:32
言語 Java21
(openjdk 21)
結果
AC  
実行時間 124 ms / 2,000 ms
コード長 416 bytes
コンパイル時間 3,853 ms
コンパイル使用メモリ 70,952 KB
実行使用メモリ 56,260 KB
最終ジャッジ日時 2023-09-12 22:43:07
合計ジャッジ時間 6,264 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
55,780 KB
testcase_01 AC 119 ms
55,864 KB
testcase_02 AC 120 ms
55,940 KB
testcase_03 AC 120 ms
55,964 KB
testcase_04 AC 120 ms
55,928 KB
testcase_05 AC 120 ms
55,996 KB
testcase_06 AC 122 ms
55,636 KB
testcase_07 AC 120 ms
55,788 KB
testcase_08 AC 121 ms
56,260 KB
testcase_09 AC 121 ms
55,536 KB
testcase_10 AC 121 ms
56,116 KB
testcase_11 AC 123 ms
56,036 KB
testcase_12 AC 124 ms
56,088 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main{
  static StringBuilder sb = new StringBuilder("");
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int A = sc.nextInt();
    int B = sc.nextInt();
    int I = A;
    int k =0;
    for (int i = A;i <= B ;i++ ) {
      if ((A+B+I)%3==0) {
        k++;
        I++;
      }else{
        I++;
      }
    }
    System.out.println(k);
  }
}
0