結果

問題 No.851 テストケース
ユーザー mmn15277198mmn15277198
提出日時 2020-09-01 22:02:53
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 864 bytes
コンパイル時間 1,164 ms
コンパイル使用メモリ 98,532 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-30 20:48:31
合計ジャッジ時間 1,582 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 1 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 1 ms
6,940 KB
testcase_08 AC 2 ms
6,940 KB
testcase_09 AC 2 ms
6,944 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 1 ms
6,944 KB
testcase_12 AC 2 ms
6,940 KB
testcase_13 AC 1 ms
6,940 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 2 ms
6,940 KB
testcase_16 AC 2 ms
6,940 KB
testcase_17 AC 2 ms
6,940 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 1 ms
6,944 KB
testcase_20 AC 2 ms
6,940 KB
testcase_21 AC 1 ms
6,940 KB
testcase_22 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<vector>
#include<string.h>
#include<math.h>
#include<map>
#include<iomanip>
#include<queue>

using namespace std;

long long s_to_ll(string s){
	long long res=0;
	for(int i=0;i<s.size();i++){
		res+=(long long)(s[i]-'0');
		res*=10;
	}
	res/=10;
	//cout << res << endl;
	return res;
}

int main(){
	int n;
	cin >> n;
	vector<long long> a;
	string skip,t;
	getline(cin,skip);
	for(int i=0;i<=n;i++){
		if(i==0)continue;
		getline(cin,t);
		for(int j=0;j<t.size();j++){
			if(t[j]>'9' || '0'>t[j]){
				cout << '"' << "assert" << '"' << endl;
				return 0;
			}
		}
		a.push_back(s_to_ll(t));
	}
	
	vector<long long> b(n);
	b[0]=a[0]+a[1];
	b[1]=a[0]+a[2];
	b[2]=a[1]+a[2];
	sort(b.begin(),b.end());
	
	if(b[2]>b[1])cout << b[1] << endl;
	else cout << b[0] << endl;
	
	return 0;
}
0