結果
問題 | No.1298 OR XOR |
ユーザー |
|
提出日時 | 2020-11-27 22:10:32 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 656 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 32,000 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-26 13:02:23 |
合計ジャッジ時間 | 1,077 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 13 |
ソースコード
#include<cstdio>long long pow2[55];int main(){long long n;scanf("%lld",&n);long long base = 1;int find = 0;pow2[0] = 1;for(int i = 1; i < 40; i++){pow2[i] = pow2[i-1]*2ll;if(n==base) find = 1;base *= 2ll;}if(find) printf("-1 -1 -1\n");else{long long a = 0, b = 0, c = 0;int cnt = 0;for(int i = 0; i <= 40; i++){if(n&pow2[i]){cnt++;if(cnt==1) a += pow2[i], b += pow2[i];else b += pow2[i], c += pow2[i];}}printf("%lld %lld %lld\n",a,b,c);}return 0;}