結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2019-08-26 14:22:01 |
言語 | C (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,042 bytes |
コンパイル時間 | 341 ms |
コンパイル使用メモリ | 31,744 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-07 18:57:52 |
合計ジャッジ時間 | 1,187 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 14 |
ソースコード
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdbool.h> #include <math.h> int main(void) { long long int gyou,space,tab,bigspace=0,max=0; long long int haba[2000]={0}; bool alreadyprint=false; scanf("%lld",&gyou); for(int i=0;i<gyou;i++) { scanf("%lld %lld",&space,&tab); haba[i]=space+4*tab; if(haba[i]>max) { max=haba[i]; } } for(int i=0;i<gyou;i++) { if(haba[i]%2==0&&i!=gyou-1) { if(haba[i+1]%2==1) { printf("-1"); alreadyprint=true; break; } } else if(i!=gyou-1) { if(haba[i+1]%2==0) { printf("-1"); alreadyprint=true; break; } } if(max!=haba[i]) { bigspace+=(max-haba[i])/2; } } if(alreadyprint==false) { printf("%d",bigspace); } }