結果
問題 | No.420 mod2漸化式 |
ユーザー | nCk_cv |
提出日時 | 2016-09-13 16:47:59 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 3,125 bytes |
コンパイル時間 | 2,190 ms |
コンパイル使用メモリ | 78,248 KB |
実行使用メモリ | 104,412 KB |
最終ジャッジ日時 | 2024-11-17 04:54:27 |
合計ジャッジ時間 | 24,732 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 109 ms
59,784 KB |
testcase_01 | TLE | - |
testcase_02 | AC | 91 ms
57,836 KB |
testcase_03 | AC | 79 ms
104,412 KB |
testcase_04 | AC | 90 ms
57,528 KB |
testcase_05 | AC | 89 ms
104,204 KB |
testcase_06 | AC | 80 ms
57,800 KB |
testcase_07 | AC | 111 ms
54,920 KB |
testcase_08 | AC | 115 ms
53,072 KB |
testcase_09 | AC | 147 ms
52,784 KB |
testcase_10 | AC | 214 ms
52,584 KB |
testcase_11 | AC | 353 ms
52,708 KB |
testcase_12 | AC | 596 ms
52,756 KB |
testcase_13 | AC | 991 ms
52,760 KB |
testcase_14 | TLE | - |
testcase_15 | TLE | - |
testcase_16 | TLE | - |
testcase_17 | TLE | - |
testcase_18 | TLE | - |
testcase_19 | TLE | - |
testcase_20 | TLE | - |
testcase_21 | TLE | - |
testcase_22 | AC | 624 ms
52,640 KB |
testcase_23 | AC | 365 ms
52,796 KB |
testcase_24 | AC | 218 ms
52,360 KB |
testcase_25 | AC | 152 ms
52,724 KB |
testcase_26 | AC | 124 ms
52,756 KB |
testcase_27 | AC | 110 ms
52,536 KB |
testcase_28 | AC | 104 ms
52,744 KB |
testcase_29 | AC | 85 ms
50,584 KB |
testcase_30 | AC | 81 ms
50,596 KB |
testcase_31 | AC | 79 ms
50,712 KB |
testcase_32 | AC | 78 ms
50,712 KB |
testcase_33 | AC | 94 ms
51,292 KB |
testcase_34 | AC | 92 ms
51,724 KB |
testcase_35 | AC | 90 ms
102,892 KB |
ソースコード
import java.io.IOException; import java.io.InputStream; import java.util.NoSuchElementException; public class Main { static long MOD = 1000000007L; static int count = 0; public static void main(String[] args) { FastScanner sc = new FastScanner(); int x = sc.nextInt(); long ans = dfs(0,x,0); System.out.println(count + " " + ans); } static long dfs(long s, int id,int idx) { if(id == 0) { count++; return s; } if(idx == 31) return 0; if(id + idx > 31) return 0; return dfs(s | 1L << idx,id-1,idx+1) + dfs(s, id, idx+1); } } class FastScanner { private final InputStream in = 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 void skipUnprintable() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;} public boolean hasNext() { skipUnprintable(); 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() { if (!hasNext()) throw new NoSuchElementException(); int 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(); } } }