結果
問題 |
No.178 美しいWhitespace (1)
|
ユーザー |
![]() |
提出日時 | 2019-08-26 14:22:49 |
言語 | C (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 1,044 bytes |
コンパイル時間 | 287 ms |
コンパイル使用メモリ | 31,616 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-07 18:57:56 |
合計ジャッジ時間 | 976 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 21 |
ソースコード
#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("%lld",bigspace); } }