东方博宜OJ答案 (1021~1030)

本文档提供了东方博宜OJ1021-1030的C++程序代码以及解答,涉及循环结构、条件判断、整数运算和基础算法问题。
摘要由CSDN通过智能技术生成

前言

欢迎大家能看到我的文章,这篇文章收录了东方博宜OJ 1021~1030所有题目的答案,后续还会往后出,敬请关注!如遇不足,欢迎指出!(不要喷我┭┮﹏┭┮)

注:部分源于其他博主!

1021

#include <iostream>
using namespace std;
int main()
{
	for (int i = 1; i <= 500; i++){
		if (i % 3 == 2 && i % 5 == 3 && i % 7 == 2)
		{
			cout << i << endl;}
		}
	return 0;
}

1022

#include <iostream>
using namespace std;
int main()
{
	for (int i = 1; i <= 20; i++)
	{
		for (int j = 30; j >= 0; j--)
		{
			if (7 * i + 4 * j == 100&&(100-i-j)%3==0)
			{
				cout << i << " " << j << " " << 100 - i - j << endl;
			}
		}
	}
	return 0;
}

1023

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int num = 0;
	if (n == 1)
	{
		cout << "F";
	}
	for (int i = 2; i < sqrt(n); i++)
	{
		if (n % i == 0&&n/i!=1&&n>=2)
		{
			num = 1;
			cout << "F";
			break;
		}
	}
	if (num == 0&&n>=2)
	{
		cout << "T";
	}
	return 0;
}

1024

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int num = 0;
	for (int i = 1; i <= 63; i++)
	{
		for (int j = 1; j <= 250; j++)
		{
			for (int k = 1; k <= 500; k++)
			{
				if (i + j + k > 30 && 8 * i + 2 * j + k == 10 * n)
				{
					num++;
				}
			}
		}
	}
	cout << num;
	return 0;
}

1025

简单的输出。

#include <iostream>
using namespace std;
int main()
{
    cout << 461;
    return 0;
}

1026

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

1027

#include <iostream>
using namespace std;
int main()
{
	int n, n1, g, s, b;
	cin >> n;
	g = n % 10;
	s = n % 100 / 10;
	b = n / 100;
	n1 = g + s + b;
	cout << n1;
	return 0;
}

1028

#include <bits/stdc++.h>
using namespace std;     
int main(){
	int n,n1,g,s,b;
	cin>>n;
	g=n%10;
	s=n%100/10;
	b=n/100;
	n1=g*100+s*10+b;
	cout<<n1;
	return 0;
}

1029

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

1030

#include <iostream>
using namespace std;
int main()
{
	int a, b;
	cin >> a >> b;
	if (a % b == 0)
	{
		cout << a / b;
	}
	else if (a % b != 0)
	{
		cout << a / b + 1;
	}
	return 0;
}
  • 13
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值