結果

問題 No.851 テストケース
ユーザー ohreitetsu
提出日時 2019-07-27 14:00:16
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 3,153 ms
コード長 929 bytes
コンパイル時間 633 ms
コンパイル使用メモリ 82,372 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-02 10:59:35
合計ジャッジ時間 1,322 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string.h>
#include <vector>
#include <map>
using namespace std;
typedef long long LL;
int Gets(char *buff,int buffMaxSize)
{
	buff[0]='\0';
	if (fgets(buff,buffMaxSize,stdin)==NULL){
		return -1;
	}
	size_t strLen = strlen(buff);
	if (strLen>0){
		while (buff[strLen-1] == '\r' || buff[strLen-1]=='\n'){//改行コード
			strLen--;
			buff[strLen]='\0';
		}
	}
	return (int)strLen;
}
int main(int argc, char* argv[])
{
	int N,i;
	char buff[100];
	Gets(buff,100);
	N=atoi(buff);
	vector<LL> A(N);
	for (i=0;i<N;i++){
		int len=Gets(buff,100);
		if (len<=0){
			cout<<"\"assert\""<<endl;
			return 0;
		}
		sscanf(buff,"%lld",&A[i]);
	}
	map<LL,int> B;
	int j=0;
	for (i=0;i<N-1;i++){
		for (j=i+1;j<N;j++){
			B[A[i]+A[j]]=1;
		}
	}
	map<LL,int>::iterator mit;
	mit=B.begin();
	switch(B.size()){
		case 1:
		case 2:
			break;
		case 3:
			mit++;
			break;
	}
	cout<<(*mit).first<<endl;
	return 0;
}
0