信奥一本通 程序的控制结构

这篇博客深入探讨了程序控制结构,包括不同类型的控制结构,如条件语句、循环语句等,旨在为信奥竞赛提供全面的指导。
摘要由CSDN通过智能技术生成
2051
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	int a;
	cin >> a;
	
	if (a % 2 == 0) cout << "yes" << endl;
	
	return 0; 
} 
2052
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	int a;
	cin >> a;
	
	if (a > 1 && a < 100) cout << "yes" << endl;

	return 0; 
} 
2053
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	int a, b, c;
	cin >> a >> b >> c;

	if (a < b) swap(a, b);
	if (b < c) swap(b, c);
	if (a < b) swap(a, b);
	
	cout << a << ' ' << b << ' ' << c << endl;	

	return 0; 
} 
2054
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	double t;
	cin >> t;
	
	if (t >= 25 && t <= 30) cout << "ok!" << endl;
	else cout << "no!" << endl;

	return 0; 
} 
2055
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	double w, ans;
	cin >> w;
	
	if (w <= 20) ans = 1.68 * w;
	else ans = 1.98 * w;	

	printf("%.2f\n", ans);

	return 0; 
} 
2056
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	double a, b, c;
	cin >> a >> b >> c;
	
	double ans = max(max(a, b), c);
	printf("%.2f\n", ans);

	return 0; 
} 
1039
#include <iostream>
#include <cstdio>
using namespace std;

int main() {
   
	int n;
	cin >> n;
	
	if (n > 0) puts("positive");
	else if (n == 0) puts("zero");
	else puts("negative");

	return 0; 
} 
1040
#include <cstdio>
using namespace std;

int main() {
   
	float a;
	scanf("%f",
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值