結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2015-07-08 01:13:36 |
言語 | C90 (gcc 12.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 512 bytes |
コンパイル時間 | 322 ms |
コンパイル使用メモリ | 20,736 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-08 01:36:42 |
合計ジャッジ時間 | 1,052 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 14 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:9:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 9 | scanf("%d", &n); | ^~~~~~~~~~~~~~~ main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 12 | scanf("%d %d", &a[i], &b[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> int main(void){ int i,n; int evenodd = 0; int maxSpace = 0; int a[1010],b[1010]; int ans = 0; scanf("%d", &n); for(i=0;i<n;i++){ int calc; scanf("%d %d", &a[i], &b[i]); if(a[i]%2 == 0){ evenodd |= 1; }else{ evenodd |= 2; } calc = a[i] + 4 * b[i]; if(maxSpace < calc ){ maxSpace = calc; } } if(evenodd == 3){ ans = -1; }else{ for(i=0;i<n;i++){ int calc = a[i] + 4 * b[i]; ans += (maxSpace - calc)/2; } } printf("%d\n", ans); return 0; }