ybt题解1006~1038+1414+2064~2073(顺序结构程序设计)

自己看吧,不想多说了。

1006:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b;
	c=a+b;
	cout<<c;
	
 }

1007:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;
	d=(a+b)*c;
	cout<<d;
	
 }

1008:

#include<iostream>
using namespace std;
int main()
{
    int a,b,c,d;
    cin>>a>>b>>c;
    d=(a+b)/c;
    cout<<d;
    
 }

1009:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b;
	c=a/b;
	d=a%b;
	cout<<c<<" "<<d;
	
 }

1010:

#include<cstdio>
#include<iostream> 
using namespace std;
int main()
{
    int a,b;
    double c;
	cin>>a>>b;
	c=(double)a/(double)b;
	printf("%.9lf",c);
	
 }

1011:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	double c;
	cin>>a>>b;
	c=(double)b*100/(double)a;
	printf("%.3lf%%",c);
}

1012:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double x,a,b,c,d;
	cin>>x>>a>>b>>c>>d;
	x=(a*x*x*x)+(b*x*x)+(c*x)+d;
	printf("%.7lf",x); 
 }

1013:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double f,c;
	cin>>f;
	c=5*(f-32)/9;
	printf("%.5lf",c);
 }

1014:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a,b,c,d;
	cin>>a;
	b=a*2;
	c=b*3.14159;
	d=a*a*3.14159;
	printf("%.4lf %.4lf %.4lf",b,c,d);
 }

1015:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a,b,c;
	cin>>a>>b;
	c=1/((1/a)+(1/b));
	printf("%.2lf",c);
 }

1016:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
    int a;
	short b;
    cout<<sizeof(a)<<" "<<sizeof(b);
}

1017:

#include<iostream>
using namespace std;
int main()
{
   float a;
   double b;
   cout<<sizeof(a)<<" "<<sizeof(b);
}

1018:

#include<iostream>
using namespace std;
int main()
{
   bool a;
   char b;
   cout<<sizeof(a)<<" "<<sizeof(b);
}

1019:

#include<cmath>
#include<iostream>
using namespace std;
int main()
{
   double a;
   int b;
   cin>>a;
   b=a;
   cout<<b;
}

1020:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	char a;
	int b;
	a=getchar();
	b=a;
	cout<<b;
}

1021:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a;
	cin>>a;
	putchar(a);
}

1022:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b;
	bool c;
	cin>>a;
	c=a;
	b=c;
	cout<<b;
 }

1023:

#include<iostream>
using namespace std;
int main()
{
	cout<<sizeof("Hello, World!");
}

1024:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	float a;
	cin>>a;
	printf("%.3lf",a);
	return 0;
}

1025:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a;
	cin>>a;
	printf("%.12lf",a);
	return 0;
}

1026:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	char a;
	int b;
	float c;
	double d;
	cin>>a>>b>>c>>d;
	cout<<a<<" "<<b<<" ";
	printf("%.6lf %.6lf",c,d);
 }

1027:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a;
	cin>>a;
	printf("%lf\n",a);
	printf("%.5lf\n",a);
	printf("%e\n",a);
	printf("%g\n",a);

}

1028:

#include<iostream>
using namespace std;
int main()
{
	char a;
	cin>>a;
	cout<<" "<<" "<<a<<endl;
    cout<<" "<<a<<a<<a<<endl;
    cout<<a<<a<<a<<a<<a<<endl;
    cout<<" "<<a<<a<<a<<endl;
    cout<<" "<<" "<<a<<endl;
    return 0;	
 }

1029:

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	double a,b,r;
	int k;
	cin>>a>>b;
	k=a/b;
	r=a-(b*k);
	cout<<r;
	return 0;
 }

1030:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	double r,v;
	cin>>r;
	v=(4.0/3)*3.14*r*r*r;
	printf("%.2lf",v);
	return 0;
}

1031:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a;
	b=a/100;
	c=a%100/10;
	d=a%10;
	cout<<d<<c<<b;
 }

1032:

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	int a,b,h,r;
	cin>>h>>r;
	a=r*r*h*3.1415926;
	b=20000/a;
	a=b+1;
	
	cout<<a;
	
}

1033:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	double a1,a2,b1,b2,s;
	cin>>a1>>a2;
	cin>>b1>>b2;
	s=(a1-b1)*(a1-b1)+(a2-b2)*(a2-b2);
	printf("%.3lf",sqrt(s));
	return 0;
}

1034:

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	double x1,y1,x2,y2,x3,y3;
	double s,p,a,b,c;
	cin>>x1>>y1>>x2>>y2>>x3>>y3;
	a=sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));
	b=sqrt((x3-x2)*(x3-x2)+(y3-y2)*(y3-y2));
	c=sqrt((x3-x1)*(x3-x1)+(y3-y1)*(y3-y1));
	p=(a+b+c)/2;
	s=sqrt(p*(p-a)*(p-b)*(p-c));
	printf("%.2lf",s);
	return 0;
}

1035:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;
	d=b-a;
	c=(c-2)*d;
	c=b+c;
        cout<<c;
 }

1036:

#include<iostream>
using namespace std;
int main()
{
	long long a,b,c;
	cin>>a>>b;
	c=a*b;
	cout<<c;
	return 0;
 }

1037:

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,b;
	cin>>a;
	b=pow(2,a);
	cout<<b;
	return 0;
 }

1038:

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
	int a,n,x,y;
	cin>>n>>x>>y;
	if(y%x==0)
	{
		a=n-(y/x);
		if(a<0)
		{
			a=0;
		}
		cout<<a;
	}
	if(y%x>0)
	{
		a=n-((y/x)+1);
		if(a<0)
		{
			a=0;
		}
		cout<<a;
	}
	return 0;
 }
//这题是顺序结构,但是用选择结构更简便(个人观点)

1414:

#include<bits/stdc++.h>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;
	d=(a*0.2)+(b*0.3)+(c*0.5);
	cout<<d;
}
//为什么NOIP会有这么简单的题?

2064:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	cin>>a>>b;
	c=a;
	a=b;
	b=c;
	cout<<a<<" "<<b;
        return 0;
}

2065:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d;
	cin>>a>>b>>c;
	d=a+b+c;
	cout<<d;
	return 0;
 }

2066:

#include<cstdio>
#include<iostream> 
using namespace std;
int main()
{
    double n,m,c,d;
	cin>>n>>m;
	c=m*0.8;
	d=n-c;
	printf("%.2lf",d);
	
 }

2067:

#include<cstdio>
#include<iostream> 
using namespace std;
int main()
{
    double a,b,c,d;
	cin>>a;
	b=a*2;
	c=a*2*3.1415926;
	d=a*a*3.1415926;
	printf("%.4lf %.4lf %.4lf",b,c,d);
	
 }

2068:

#include<iostream> 
using namespace std;
int main()
{
    double a,b,m,n;
	cin>>n>>m;
	a=(4*n-m)/2;
	b=(m-2*n)/2;
	cout<<a<<" "<<b;
    return 0;
 }

2069:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	a=a/3;
	e+=a;
	b+=a;
	b=b/3;
	a+=b;
	c+=b;
	c=c/3;
	b+=c;
	d+=c;
	d=d/3;
	c+=d;
	e+=d;
	e=e/3;
	d+=e;
	a+=e;
	printf("%5d%5d%5d%5d%5d",a,b,c,d,e);
	return 0;
 }

2070:

#include<iostream>
using namespace std;
int main()
{
	int a,b,c,d,e;
	cin>>a;
	b=a/100;
	c=a%100/10;
	d=a%10;
	e=d*100+c*10+b*1;
	cout<<e;
 }

2071:

#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
	double a,b,c;
	cin>>a>>b;
	c=((a*87)+(b*85))/(a+b);
	printf("%.4lf",c);
	return 0;
 }

2072:

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	double a,b,c,d;
	a=6*9.6;
	b=a-(5*9.8);
	c=a-(5*9.4);
	d=(a-b-c)/4;
	printf("%5.2f",d);
	return 0;
 }

2073:

#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
	double a,b,c,d,p,s;
	cin>>a>>b>>c;
	p=(a+b+c)/2;
	d=p*(p-a)*(p-b)*(p-c);
	s=sqrt(d);
	printf("%.3lf",s);
	return 0;
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值