結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-11-14 16:04:41 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 356 bytes |
| コンパイル時間 | 827 ms |
| コンパイル使用メモリ | 20,608 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-26 01:04:20 |
| 合計ジャッジ時間 | 948 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 7 WA * 14 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:7:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d%d",&a,&b);
| ^~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
int main(void){
int n,len[1024],a,b,g,i,nlen,m=0,r = 0;
scanf("%d",&n);
for(i = 1;i <= n;i++){
scanf("%d%d",&a,&b);
nlen = a+4*b;
len[i] = nlen;
if(i == 1){g = nlen %2;}
else if(nlen%2 != g){printf("-1\n");return 0;}
if(nlen > m){m = nlen;}
}
for(i = 1;i <= n;i++){
r+=(m-len[i]);
}
printf("%d\n",r/2);
return 0;
}