結果

問題 No.100 直列あみだくじ
ユーザー akakimidori
提出日時 2015-07-27 14:51:57
言語 C90
(gcc 12.3.0)
結果
WA  
実行時間 -
コード長 257 bytes
コンパイル時間 106 ms
コンパイル使用メモリ 20,480 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-16 04:08:37
合計ジャッジ時間 1,440 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31 WA * 14
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |         scanf("%d",&N);
      |         ^~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%d",&a);
      |                 ^~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>

#define ABS(a) ((a)>0?(a):-(a))

int main(void){
	int N;
	scanf("%d",&N);
	int a;
	int i;
	int sum=0;
	for(i=1;i<=N;i++){
		scanf("%d",&a);
		sum+=ABS(i-a);
	}
	if(sum%4==0){
		printf("Yes\n");
	} else {
		printf("No\n");
	}
	return 0;
}
0