http://codeforces.com/contest/31

A

 1 #include<bits/stdc++.h>
 2 using namespace std;
 3 #define lson l,mid,rt<<1
 4 #define rson mid+1,r,rt<<1|1
 5 #define sqr(x) ((x)*(x))
 6 #define pb push_back
 7 #define maxn 1000005
 8 typedef long long ll;
 9 typedef unsigned long long ull;
10 /*#ifndef ONLINE_JUDGE
11         freopen("1.txt","r",stdin);
12 #endif */
13 
14 int a[105];
15 
16 int main(){
17     #ifndef ONLINE_JUDGE
18         freopen("1.txt","r",stdin);
19     #endif
20     std::ios::sync_with_stdio(false);
21     int n;
22     cin>>n;
23     for(int i=1;i<=n;i++) cin>>a[i];
24     for(int i=1;i<=n;i++){
25         for(int j=1;j<=n;j++){
26             for(int k=1;k<=n;k++){
27                 if(i!=j&&j!=k){
28                     if(a[i]==a[j]+a[k]){
29                         cout<<i<<" "<<j<<" "<<k<<endl;
30                         return 0;
31                     }
32                 }
33             }
34         }
35     }
36     cout<<-1<<endl;
37 }
View Code

相关文章: