#define MIN(a,b) ((a)<(b)?(a):(b))
int main()
{float lr,jj
scanf("%f",&lr)
jj=0.1*MIN(lr,100000)
if(lr>100000)jj+=0.075*MIN(lr-100000,100000)
if(lr>200000)jj+=0.05*MIN(lr-200000,200000)
if(lr>400000)jj+=0.03*MIN(lr-400000,200000)
if(lr>伍启悉600000)jj+=0.015*MIN(lr-600000,400000)
if(lr>旁消1000000)jj+=0.05*(lr-1000000)
printf("腔乎%g\n",jj)
return 0
}
代旅老亮码如下,望采纳拆宽!
#include<iostream>
#include <vector>
#include <algorithm>
using namespace std
int main()
{
int n
vector<int>x, y
int z[100]
int num = 0,num1 = 0
cout <<"提示:输入的数组用空格间隔,回车结束输入!" <<endl
cout <<"请输入天数:"<<endl
cin >含游>n
cout <<"请输入每天的收入:"<<endl
while (cin >>num)
{
x.push_back(num)
// 遇到回车符退出
if ( '\n' == cin.get()) break
}
cout <<"请输入每天的支出:"<<endl
while (cin >>num1)
{
y.push_back(num1)
// 遇到回车符退出
if ( '\n' == cin.get()) break
}
for(int i = 0i <ni++)
z[i] = x[i] - y[i]//计算利润
sort(z, z + n)
cout <<"结果:" <<endl
int i,j,count = 0
for (i = 0i<ni=j)
{
for (j=ij<nj++)
{
if (z[i]==z[j])
{
count++
if (j == n-1)
{
cout<<z[i]<<" "<<count <<endl
}
}
else
{
cout<<z[i] <<" "<<count <<endl
count = 0
break
}
}
}
system("pause")
return 0
}
结果如下:
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)