首页 > 其他分享 >打卡6

打卡6

时间:2023-04-17 17:24:46浏览次数:29  
标签:else x8 ans x2 x3 打卡 x5

2.1个人所得税问题

 //if   else就可以

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
int main()
{
cin>>n;
double ans;
if(n<3500)cout<<n;//小于起征点

else//达到了起征点
{
if(n<=4500) ans=1500*(0.97)+(n-1500)*(0.9);
else if(n<=9000)ans=1500*0.97+3000*0.9+(n-4500)*0.8;
else if(n<=35000)ans=1500*0.97+3000*0.9+4500*0.8+(n-9000)*0.75;
else if(n<=55000)ans=1500*0.97+3000*0.9+4500*0.8+26000*0.75+0.7*(n-35000);
else if(n<=80000)ans=1500*0.97+3000*0.9+4500*0.8+26000*0.75+0.7*20000+(n-55000)*0.65;
else ans=ans=1500*0.97+3000*0.9+4500*0.8+26000*0.75+0.7*20000+25000*0.65+(n-80000)*0.55;
cout<<ans<<endl;
}

return 0;
}

 

2.2存钱问题

 流程图

 

#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
typedef long long ll;
int main()
{
int x1,x2,x3,x5,x8,y1,y2,y3,y5,y8;
double ans=-50.0,r;
for(x8=0;x8<=2;x8++)
{
for(x5=0;x5<=(20-8*x8)/5;x5++)
{
for(x3=0;x3<(20-8*x8-5*x5)/3;x3++)
{
for(x2=0;x2<(20-3*x3-5*x5-8*x8)/2;x2++)
{
x1=-2*x2+20-3*x3-5*x5-8*x8;
r=2000.0*pow((1+0.0063*12),x1)*pow((1+0.0066*12),x2)
*pow((1+0.0069*12),x3)*pow((1+0.0075*12),x5)*pow((1+0.0084),x8);
if(r>ans)
{
ans=r;
y1=x1;
y2=x2;
y3=x3;
y5=x5;
y8=x8;
}
}
}
}
}
cout<<y1<<' '<<y2<<' '<<y3<<' '<<y5<<' '<<y8<<endl;
cout<<ans;
return 0;
}

 

标签:else,x8,ans,x2,x3,打卡,x5
From: https://www.cnblogs.com/litianyu1969/p/17326485.html

相关文章

  • 4.17打卡
    #include<iostream>#include<iomanip>#include<cmath>usingnamespacestd;intmain(){cout<<2<<endl;inti,j,k,flag;i=3;while(i<=100){j=2;k=sqrt(i);flag=1;whil......
  • 建民の每日打卡6
    一、问题描述 二、流程设计1.输入方程系数abcd2.将方程根x设为1.53.建立循环,将x赋值给x0,并按公式求出新的x。实现迭代4.当迭代满足条件后输出x值三、流程图设计 四、代码实现#include<iostream>#include<cmath>usingnamespacestd;intmain(){ floata,b,c,d,x,x0,......
  • 打卡第五天
    输入一个0~6的整数,转换成对应的星期输出一、1.定义一个变量day,用于存储输入值2.用switch语句将数字尽享转换并输出二、三、#include<iostream>usingnamespacestd;intmain(){ intday; cout<<"输入数字:"; cin>>day; switch(day) { case0: cout<<"Sunday"<<endl; ......
  • leetcode_打卡5
    leetcode_打卡5题目:345.反转字符串中的元音字母思路:双指针classSolution{publicStringreverseVowels(Strings){intn=s.length();char[]arr=s.toCharArray();inti=0;intj=n-1;while(i<j){while(i<n&&!yua......
  • 2023.4.16编程一小时打卡
    一、问题描述:线性代数里面我们学习过n维向量,请用类vector_N来封装n维整型向量,成员如下;私有数据成员: 向量维数n,int型指针p,int型公有函数成员:无参默认构造函数,在该函数中,将n置0,将p置null;重载输入输出运算符,输入运算符,先指定向量维数,若输入为非正整数,则提示错误信息,“Error......
  • c++训练打卡(8)
    冒泡排序流程图:伪代码:源代码:#include<stdio.h>intmain(){ intN,i,j,Max; inta[100]; printf("请输入要比较的数据的个数:"); scanf("%d",&N); printf("请输入所要比较的数据:"); for(i=0;i<N;i++){ scanf("%d",&a[i]); } for(i=0;i<N;i......
  • 每日打卡-5.2
    一.问题描述小A是某工地的计算工程师。工地现有n根钢管,第i根钢管的长度为ai。现在想用这n根钢管来做一个支撑用的柱子。我么可以切割这些钢管成为更短的钢管,但是不能缝合两根钢管。为了安全起见,柱子必须用至少k根长度相同的钢管加上混凝土制成,并且要求钢管长度必须为......
  • 每日打卡
    //#include<iostream>//usingnamespacestd;//intmain()//{// longlongintA,B,C;intD;// cin>>A>>B>>D;// C=A+B;// intn=0;// longlongm=C;// while(m!=0)// {// n++;// m/=D;// }// int*a=newint[n];// for......
  • 每日打卡-5.1
    一.问题描述  小A所在的学校又迎来了一年一度的开花活动,有n名学生被评为文学优秀奖,m名学生被评为体育优秀奖。现已知两个奖项获奖同学的编号,每个同学都有唯一的编号。只有同时被评为文学优秀奖和体育优秀奖的学生才能开花,小A想知道开花的名单,请你帮他统计一下。注:1<=n,m<=1e......
  • 天天打卡一小时——3
    一.问题描述输入一个0~6的数字,转化成数字输出二.设计思路1.输入0~6中任意一个数字2.需要运用多重分支结构3.选用switch语句三.程序流程图画不出来四.代码实现#include<iostream>usingnamespacestd;intmain(){intday;cin>>day;switch(day){case0:c......