问题标题: 酷町堂:1706

0
0
已解决
胡钰妍
胡钰妍
资深光能
资深光能

#include <iostream>

#include <cstring>

using namespace std;

int main() {

int a[10][10],b[10],c[10],d[10],e[10];

bool f;

for(int i=1;i<=5;i++){

for(int j=1;j<=5;j++){

cin>>a[i][j];

if(a[i][j]>b[i]){

b[i]=a[i][j];

d[i]=j;

}

}

}

memset(c,0x3f3f3f3f,sizeof(c));

for(int j=1;j<=5;j++){

for(int i=1;i<=5;i++){

if(a[i][j]<c[j]){

c[j]=a[i][j];

e[j]=i;

}

}

}

for(int i=1;i<=5;i++){

for(int j=1;j<=5;j++){

if(d[i]==j&&e[j]==i){

cout<<i<<" "<<j<<" "<<a[i][j]<<endl;

f=1;

}

}

}

if(!f)cout<<"not found";

return 0;

}

哪错了??@包思远

胡钰妍在2021-04-23 21:39:34追加了内容

#include<bits/stdc++.h>

using namespace std;

int main()

{

int n;

double sum=0.0;

cin>>n;

if(n<=3500)sum=0.0;

else if(n>3500&&n<=5000)sum=n*0.03;

else if(n>5000&&n<=8000)sum=(5000-3500)*0.03+(n-5000)*0.10;

else if(n>8000&&n<=12500)sum=(5000-3500)*0.03+(8000-5000)*0.10+(n-8000)*0.20;

else if(n>12500&&n<=38500)sum=(5000-3500)*0.03+(8000-5000)*0.10+(12500-8000)*0.20+(n-12500)*0.25;

else if (n<=83500) sum=(5000-3500)*0.03+(8000-5000)*0.1+(12500-8000)*0.2+(38500-

12500)*0.25+(58500-38500)*0.3+(n-58500)*0.35;

else if(n>58500&&n<=83500)sum=(5000-3500)*0.03+(8000-5000)*0.10+(12500-8000)*0.20+(38500-12500)*0.25+

(58500-38500)*0.30+(n-58500)*0.35;

else sum=(5000-3500)*0.03+(8000-5000)*0.10+(12500-8000)*0.20+(38500-12500)*0.25+(58500-38500)*0.30+

(83500-58500)*0.35+(n-83500)*0.45;

printf("%.2f",sum);

return 0;

}

1753哪错了??有其一即可采纳

胡钰妍在2021-04-25 18:37:10追加了内容

错了,只要1706


0
已采纳
包思远
包思远
新手启示者
新手启示者

bool f=0;

f要赋初值为0

包思远在2021-04-25 22:41:43追加了内容

还有,数组最好定义在main()函数外面

0
0
0
我要回答