結果

問題 No.2551 2, 3, 5, 7 Game
ユーザー tentententen
提出日時 2023-11-27 11:46:51
言語 Java21
(openjdk 21)
結果
AC  
実行時間 443 ms / 2,357 ms
コード長 1,879 bytes
コンパイル時間 3,706 ms
コンパイル使用メモリ 89,748 KB
実行使用メモリ 65,732 KB
最終ジャッジ日時 2023-11-27 11:46:59
合計ジャッジ時間 6,207 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
53,984 KB
testcase_01 AC 52 ms
53,952 KB
testcase_02 AC 52 ms
53,972 KB
testcase_03 AC 53 ms
53,976 KB
testcase_04 AC 52 ms
53,964 KB
testcase_05 AC 423 ms
65,712 KB
testcase_06 AC 410 ms
65,708 KB
testcase_07 AC 407 ms
65,732 KB
testcase_08 AC 443 ms
65,648 KB
testcase_09 AC 344 ms
63,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        int t = sc.nextInt();
        StringBuilder sb = new StringBuilder();
        int[] div = new int[]{2, 7};
        String[] names = new String[]{"sepa", "ryota"};
        while (t-- > 0) {
            long n = sc.nextLong();
            int idx = 0;
            while (n > 1) {
                n = (n + div[idx] - 1) / div[idx];
                idx ^= 1;
            }
            sb.append(names[idx]).append("\n");
        }
        System.out.print(sb);
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0