結果
問題 | No.581 XOR |
ユーザー |
![]() |
提出日時 | 2023-09-03 15:28:11 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 235 bytes |
コンパイル時間 | 986 ms |
コンパイル使用メモリ | 20,608 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 21:09:42 |
合計ジャッジ時間 | 721 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 6 WA * 2 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:8:18: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 2 has type ‘long long int *’ [-Wformat=] 8 | scanf("%ld%ld", &a, &c); | ~~^ ~~ | | | | | long long int * | long int * | %lld main.c:8:21: warning: format ‘%ld’ expects argument of type ‘long int *’, but argument 3 has type ‘long long int *’ [-Wformat=] 8 | scanf("%ld%ld", &a, &c); | ~~^ ~~ | | | | | long long int * | long int * | %lld main.c:17:18: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long long int’ [-Wformat=] 17 | printf("%d\n", b); | ~^ ~ | | | | int long long int | %lld main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%ld%ld", &a, &c); | ^~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h> int main(void){ long long int a, b = 0, c; int i = 1; scanf("%ld%ld", &a, &c); while(a != 0 || c != 0){ b += ((a % 2 + c % 2) % 2) * i; a /= 2; c /= 2; i *= 2; } printf("%d\n", b); return 0; }