結果

問題 No.2655 Increasing Strides
ユーザー AsahiAsahi
提出日時 2024-03-01 22:19:03
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 7,593 bytes
コンパイル時間 3,153 ms
コンパイル使用メモリ 92,380 KB
実行使用メモリ 52,180 KB
最終ジャッジ日時 2024-09-29 14:21:17
合計ジャッジ時間 7,484 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 105 ms
52,180 KB
testcase_01 AC 104 ms
40,264 KB
testcase_02 AC 109 ms
40,416 KB
testcase_03 AC 105 ms
41,808 KB
testcase_04 AC 104 ms
41,444 KB
testcase_05 AC 109 ms
41,516 KB
testcase_06 AC 103 ms
41,560 KB
testcase_07 AC 109 ms
41,564 KB
testcase_08 AC 103 ms
41,316 KB
testcase_09 AC 102 ms
41,380 KB
testcase_10 AC 102 ms
41,860 KB
testcase_11 AC 108 ms
40,872 KB
testcase_12 AC 106 ms
40,684 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 107 ms
41,548 KB
testcase_16 WA -
testcase_17 AC 104 ms
41,284 KB
testcase_18 AC 101 ms
39,992 KB
testcase_19 AC 98 ms
40,380 KB
testcase_20 AC 100 ms
40,668 KB
testcase_21 AC 102 ms
41,556 KB
testcase_22 WA -
testcase_23 AC 105 ms
41,308 KB
testcase_24 AC 99 ms
40,400 KB
testcase_25 AC 104 ms
41,304 KB
testcase_26 WA -
testcase_27 AC 101 ms
39,996 KB
testcase_28 AC 99 ms
41,244 KB
testcase_29 AC 104 ms
41,032 KB
testcase_30 WA -
testcase_31 AC 101 ms
41,528 KB
testcase_32 AC 104 ms
41,400 KB
testcase_33 AC 104 ms
41,652 KB
testcase_34 WA -
testcase_35 AC 111 ms
50,108 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class Main implements Runnable {

    public void solve() {   
        int n = in.nextInt();
        out.print(n % 7 == 0 || n % 8 == 0 ? yes : no);
    }

    record p(int x , int y , int c , char d) { }

    public void exp() {
        int k = in.nextInt();
        int [][] g = new int[101][101];
        int size = 101 ;
        int mid = size / 2 ;
        Queue<p> q = new ArrayDeque<>();
        q.add(new p(mid , mid, 0, 'U'));
        q.add(new p(mid , mid, 0, 'D'));
        q.add(new p(mid , mid, 0, 'L'));
        q.add(new p(mid , mid, 0, 'R'));
        while(!q.isEmpty()) {
            var now = q.poll();
            if(now.c == k) continue;
            if(now.d == 'U' || now.d == 'D') {
                q.add(new p(now.x + (now.c + 1) , now.y , now.c + 1 , 'R'));
                g[now.y][now.x + (now.c + 1)] = now.c + 1 ;
                q.add(new p(now.x - (now.c + 1) , now.y , now.c + 1 , 'L'));
                g[now.y][now.x - (now.c + 1)] = now.c + 1 ;
            }
            else {
                q.add(new p(now.x  , now.y + (now.c + 1), now.c + 1 , 'D'));
                g[now.y + (now.c + 1)][now.x] = now.c + 1 ;
                q.add(new p(now.x  , now.y - (now.c + 1), now.c + 1 , 'U'));
                g[now.y - (now.c + 1)][now.x] = now.c + 1 ;
            }
        }
        for(int i = 0 ; i < 101 ; i ++) {
            for(int j = 0 ; j < 101 ; j ++) {
                out.print(g[i][j]);
            }
            out.println();
        }
        out.println(g[mid][mid]) ;
    }

    public PrintWriter out = new PrintWriter(System.out);
    public Input in = new Input() ;
    public static final int  inf = (1  << 30);
    public static final long lnf = (1L << 60);
    public static final String yes = "Yes" , no  = "No" ;
    public static final int mod7 = 1000000007 , mod9 = 998244353 ;
    public static final int [] dy4 = {-1,0,1,0} , dx4 = {0,1,0,-1};
    public static final int [] dy8 = {-1,-1,-1,0,1,1,1,0} , dx8 = {-1,0,1,1,1,0,-1,-1};

    public static void main(String [] args) { new Thread(null, new Main(), "", Runtime.getRuntime().maxMemory()).start(); }
    public void run() { solve(); out.flush(); }

}

class mint {
    
    private long value ;
    // private static final long mod = 998244353;
    private static final long mod = 1000000007;

    public mint(long value) {
        this.value = (value % mod + mod) % mod;
    }

    public mint add(mint other) {
        return new mint((this.value + other.value) % mod);
    }

    public mint sub(mint other) {
        return new mint((this.value - other.value + mod) % mod);
    }

    public mint mul(mint other) {
        return new mint((this.value * other.value) % mod);
    }

    public mint inv() {
        return new mint(pow(this.value, mod - 2));
    }

    public mint div(mint other) {
        return this.mul(other.inv());
    }

    private long pow(long a, long b) {
        long res = 1;
        while (b > 0) {
            if ((b & 1) != 0) {
                res = (res * a) % mod;
            }
            a = (a * a) % mod;
            b >>= 1;
        }
        return res;
    }

    public long getVal() {
        return value ;
    }

    @Override
    public String toString() {
        return String.valueOf(value);
    }
    
}

class Input {

    private final InputStream in = System.in;
    private final Scanner sc = new Scanner(System.in);
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { 
        if (hasNextByte()) return buffer[ptr++]; else return -1;
    }

    private static boolean isPrintableChar(int c) { 
        return 33 <= c && c <= 126;
    }

    private  boolean hasNext() { 
        while(hasNextByte() && !isPrintableChar(buffer[ptr])) {
            ptr++; 
        }
        return hasNextByte();
    }
    
    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

    public double nextDouble() { 
        return Double.parseDouble(next());
    }

    public char nextChar() {
        return next().charAt(0);
    }

    public BigInteger nextBigInteger() {
        return sc.nextBigInteger();
    }

    public int [] nextInt(int n) {
        int [] array = new int[n];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = nextInt();
        }
        return array ;
    }

    public int [][] nextInt(int n , int m) {
        int [][] array = new int[n][m];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = nextInt(m);
        }
        return array ;
    }

    public long [] nextLong(int n) {
        long [] array = new long[n];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = nextLong();
        }
        return array ;
    }

    public long [][] nextLong(int n , int m) {
        long [][] array = new long[n][m];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = nextLong(m);
        }
        return array ;
    }

    public double [] nextDouble(int n) {
        double [] array = new double[n];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = nextDouble();
        }
        return array ;
    }
    
    public String [] next(int n) {
        String [] array = new String[n];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = next();
        }
        return array ;
    }

    public String [][] next(int n , int m) {
        String [][] array = new String[n][m];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = next(m);
        }
        return array ;
    }

    public char [] nextChar(int n) {
        char [] array = new char[n];
        String string = next() ;
        for(int i = 0 ; i < n ; i ++) {
            array[i] = string.charAt(i);
        }
        return array ;
    }

    public char [][] nextChar(int n , int m) {
        char [][] array = new char[n][m];
        for(int i = 0 ; i < n ; i ++) {
            array[i] = nextChar(m);
        }
        return array ;
    }

}
0