結果
| 問題 |
No.1298 OR XOR
|
| ユーザー |
y61mpnl
|
| 提出日時 | 2020-11-27 21:26:08 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 407 bytes |
| コンパイル時間 | 2,159 ms |
| コンパイル使用メモリ | 190,888 KB |
| 最終ジャッジ日時 | 2025-01-16 06:24:39 |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:6:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d", &n);
| ~~~~~^~~~~~~~~~
ソースコード
#include<bits/stdc++.h>
#define REP(i,b,e) for(int i=b;i<e;i++)
int main(){
int n;
scanf("%d", &n);
int a, b, c, top = -1;
a = b = c = 0;
REP(i, 0, 30){
if((n>>i)&1){
a |= (1<<i);
b |= (1<<i);
top = i;
}
}
a &= ~(1<<top);
c |= (1<<top);
if(a) printf("%d %d %d\n", a, b, c);
else puts("-1 -1 -1");
return 0;
}
y61mpnl