結果
| 問題 | No.581 XOR | 
| コンテスト | |
| ユーザー |  suppy193 | 
| 提出日時 | 2023-09-03 15:32:49 | 
| 言語 | C90 (gcc 12.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 246 bytes | 
| コンパイル時間 | 578 ms | 
| コンパイル使用メモリ | 20,352 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-12 21:14:36 | 
| 合計ジャッジ時間 | 781 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 1 | 
| other | AC * 8 | 
コンパイルメッセージ
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:19: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 2 has type ‘long long int’ [-Wformat=]
   17 |         printf("%ld\n", b);
      |                 ~~^     ~
      |                   |     |
      |                   |     long long int
      |                   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;
	long long 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("%ld\n", b);
	
	return 0;
}
            
            
            
        