結果
| 問題 |
No.851 テストケース
|
| コンテスト | |
| ユーザー |
funakoshi
|
| 提出日時 | 2019-09-03 09:54:05 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 3,153 ms |
| コード長 | 1,635 bytes |
| コンパイル時間 | 192 ms |
| コンパイル使用メモリ | 31,744 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 10:10:13 |
| 合計ジャッジ時間 | 1,105 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
int main(void)
{
char str[1000]="";
int num;
scanf("%d\n",&num);
long long int numlist[3]={0};
long long int ans[3]={0};
for(int i=0;i<num;i++)
{
fgets(str,100,stdin);
for(int j=0;j<strlen(str);j++)
{
if(str[j]==' ')
{
printf("\"assert\"");
return 0;
}
else
{
numlist[i]=atoll(str);
}
}
}
for(int i=0,k=0;i<num-1;i++)
{
if(numlist[i]<0)
{
numlist[i]*=-1;
}
for(int j=i+1;j<num;j++,k++)
{
if(numlist[j]<0)
{
numlist[j]*=-1;
}
ans[k]=numlist[i]+numlist[j];
}
}
for(int i=0;i<num-1;i++)
{
for(int j=i+1;j<num;j++)
{
if(ans[i]>ans[j])
{
int tmp=ans[i];
ans[i]=ans[j];
ans[j]=tmp;
}
}
}
long long int show=0;
for(int i=0;i<2;i++)
{
for(int j=i+1;j<3;j++)
{
if(ans[i]!=ans[j])
{
show=ans[1];
}
else if(ans[i]==ans[j])
{
if(i==0)
{
show=ans[1];
}
else
{
show=ans[0];
}
}
}
}
printf("%lld",show);
}
funakoshi