Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
5100 邓小龙 找最大的数 C++ Accepted 0 MS 268 KB 466 2024-11-02 14:26:50

Tests(10/10):


Code:

#include<iostream> // cin\cout\endl using namespace std; /*思路:建一个数组,存10个数 2 4 6 3 9 6 9 2 8 1 maxn=9 pos=i+1 */ int main(){ int a[10]; int maxn=-1,pos; for(int i=0;i<10;i++){ cin>>a[i]; } for(int i=0;i<10;i++){ if(a[i]>maxn){//只要数组的值比maxn大 maxn=a[i];//改变maxn pos=i+1;//记录此位置 } } cout<<pos<<endl; return 0; }