結果
問題 | No.1895 Mod 2 |
ユーザー | publfl |
提出日時 | 2022-04-08 22:15:48 |
言語 | C++14 (gcc 13.2.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 129 ms / 2,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 284 ms |
コンパイル使用メモリ | 32,124 KB |
実行使用メモリ | 4,380 KB |
最終ジャッジ日時 | 2023-08-19 00:45:52 |
合計ジャッジ時間 | 1,834 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 17 ms
4,376 KB |
testcase_02 | AC | 24 ms
4,380 KB |
testcase_03 | AC | 109 ms
4,380 KB |
testcase_04 | AC | 92 ms
4,376 KB |
testcase_05 | AC | 129 ms
4,376 KB |
testcase_06 | AC | 129 ms
4,380 KB |
testcase_07 | AC | 127 ms
4,376 KB |
testcase_08 | AC | 66 ms
4,380 KB |
testcase_09 | AC | 79 ms
4,380 KB |
testcase_10 | AC | 30 ms
4,380 KB |
testcase_11 | AC | 94 ms
4,376 KB |
ソースコード
#include <stdio.h> long long int func(long long int k) { long long int ans = (long long int)1e16; long long int min = 0, max = (long long int)1e16; while(min<=max) { long long int h = (min+max)/2; if(h>=1e8) max = h-1; else if(h*h>k) max = h-1; else { ans = h; min = h+1; } } return (ans+1)/2; } int main() { int T; scanf("%d",&T); while(T--) { long long int a,b; scanf("%lld%lld",&a,&b); a--; int ans = 0; while(a<b) { long long int val = func(b) - func(a); ans += val%2; a/=2, b/=2; } printf("%d\n",ans%2); } }