#include<iostream> using namespace std; int main(){ int t; while(t<=10&&t>0){ int n,m; cin>>n>>m; int a[n][2]; int k; for(int i=0;i<n;i++){ cin>>a[i][0]>>a[i][1]; } for(i=0;i<m;i++){ for(int j=0;j<n;j++){ if(a[j][0]>temp){ temp = a[j][0]; k = j; } } for(j=0;j<n;j++){ if(a[j][0]==temp){ if(a[j][1]>a[k][1]) k = j; else if(a[j][1]==a[k][1]){ if(j < k) k = j; } } } return k; } } } /* Main.cc: In function 'int main()': Main.cc:14:9: error: 'i' was not declared in this scope for(i=0;i<m;i++){ ^ Main.cc:16:20: error: 'temp' was not declared in this scope if(a[j][0]>temp){ ^ Main.cc:21:11: error: 'j' was not declared in this scope for(j=0;j<n;j++){ ^ Main.cc:22:21: error: 'temp' was not declared in this scope if(a[j][0]==temp){ ^ */ |
Double click to view unformatted code.