結果

問題 No.178 美しいWhitespace (1)
ユーザー eri
提出日時 2015-07-08 03:07:26
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 423 bytes
コンパイル時間 361 ms
コンパイル使用メモリ 54,484 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-08 01:37:50
合計ジャッジ時間 3,536 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other RE * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:20:15: warning: ignoring return value of ‘int system(const char*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   20 |         system("pause");
      |         ~~~~~~^~~~~~~~~

ソースコード

diff #

#include<iostream>
using namespace std;
int main(void){
	int len[998], maxlen = 0, n;
	cin >> n;
	for (int i = 0; i < n; i++)
	{
		int a, b; cin >> a >> b;
		len[i] = a + 4 * b;
		if (len[i] > maxlen) maxlen = len[i];
	}
	long long ans = 0;
	for (int i = 0; i<n; i++){
		if ((maxlen - len[i]) % 2){
			cout << -1 << endl; return 0;
		}
		ans += (maxlen - len[i]) / 2;
	}
	cout << ans << endl;
	system("pause");
	return 0;
}
0