結果
| 問題 |
No.353 ヘイトプラス
|
| コンテスト | |
| ユーザー |
NEEHATOV
|
| 提出日時 | 2020-06-12 03:57:31 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 340 bytes |
| コンパイル時間 | 170 ms |
| コンパイル使用メモリ | 30,976 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 03:37:09 |
| 合計ジャッジ時間 | 905 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 7 |
コンパイルメッセージ
main.c: In function 'main':
main.c:9:17: warning: implicit declaration of function 'abs' [-Wimplicit-function-declaration]
9 | while (a >> abs(i) != 0) {
| ^~~
main.c:3:1: note: include '<stdlib.h>' or provide a declaration of 'abs'
2 | #include <math.h>
+++ |+#include <stdlib.h>
3 |
ソースコード
#include <stdio.h>
#include <math.h>
int main() {
int a,b,i=0,count=0;
scanf("%d %d",&a, &b);
/* 桁数を計算 */
while (a >> abs(i) != 0) {
if ((a >> abs(i)) & 0x01 && (b >> abs(i)) & 0x01){
count -= (int)pow(2, abs(i)) ;
}
i--;
}
printf("%d\n", (a|b)-count);
return 0;
}
NEEHATOV