东方博宜oj1080——1089

1080

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int i = 2;
	while (!(n == 1))
	{
		if (n % i == 0)
		{
			n /= i;
			cout << i << endl;
			i = 2;
		}
		else
		{
			i++;
		}
	}
}

1081

#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int a;
	int b;
	int c;
	a = n / 3600;
	b = n % 3600 / 60;
	c = n % 3600 % 60;
	cout << setw(2) << setfill('0') << a << ":"
		<< setw(2) << b << ":"
		<< setw(2) << c << endl;
}

1082

#include <bits/stdc++.h>
using namespace std;
int main()
{
	cout << 1534;
}

1083

#include <iostream>
#include <cmath>
using namespace std;
bool judge(int n)
{
	int num = 0;
	int sum = 0;
	for (int i = 1; n / i != 0; i *= 10)
	{
		if (n / i != 0)
		{
			num++;
		}
	}
	for (int i = 1; i < num; i++)
	{
		sum += (n - n / (int)pow(10, i) * (int)pow(10, i)) / (int)pow(10, i - 1) * (int)pow(10, num - i);
	}
	sum += n / pow(10, num - 1);
	if (sum == n)
	{
		return true;
	}
	else
	{
		return false;
	}
}
int produce(int &n)
{
	int num = 0;
	int sum = 0;
	for (int i = 1; n / i != 0; i *= 10)
	{
		if (n / i != 0)
		{
			num++;
		}
	}
	for (int i = 1; i < num; i++)
	{
		sum += (n - n / (int)pow(10, i) * (int)pow(10, i)) / (int)pow(10, i - 1) * (int)pow(10, num - i);
	}
	sum += n / pow(10, num - 1);
	n = n + sum;
	return n;
}
int main()
{
	int n;
	cin >> n;
	judge(n);
	if (judge(n) == true)
	{
		cout << 0;
		return 0;
	}
	else
	{
		int num = 0;
		while (judge(n) == false)
		{
			produce(n);
			num++;
		}
		cout << num;
		return 0;
	}
}

1084

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int sumOfFactors(int n) {
	int sum = 0; 
	int sqrtN = sqrt(n);
	for (int i = 2; i <= sqrtN; ++i) {
		if (n % i == 0) {
			sum += i;
			if (i != n / i) { 
				sum += n / i;
			}
		}
	}
	return sum;
}
 
int main() {
	int number;
	cin >> number;
	int result = sumOfFactors(number);
	cout << result;
}

1085

#include <bits/stdc++.h>
#include <cmath>
using namespace std;
int main()
{
	int a, b, c, d;
	
	for (int i = 1000; i <= 9999; i++)
	{
		a = i / 1000;
		b = i % 1000 / 100;
		c = i % 1000 % 100 / 10;
		d = i % 1000 % 100 % 10;
		if (pow(10 * a + b + 10 * c + d, 2) == 1000 * a + 100 * b + 10 * c + d)
		{
			cout << i << endl;
		}
	}
}

1086

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin >> n;
	int sum = 0;
	for (int i = 1; i <= n; i++)
	{
		for (int j = i + 1; j <= n; j++)
		{
			if ((i + j) % 3 == 0 || (i + j) % 7 == 0)
			{
				sum++;
			}
		}
	}
	cout << sum;
}

1087

#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int m, n, a, b, r;
	cin >> m >> n;
	if (m > n)
	{
		a = m;
		b = n;
	}
	else
	{
		a = n;
		b = m;
	}
	r = b;
	while (r != 0)
	{
		r = a % b;
		a = b;
		b = r;
	}
	m /= a;
	n /= a;
	cout << a * m * n;
}

1088

#include <bits/stdc++.h>
using namespace std;
int main()
{
	long long int m, n, a, b, r;
	cin >> m >> n;
	if (m > n)
	{
		a = m;
		b = n;
	}
	else
	{
		a = n;
		b = m;
	}
	r = b;
	while (r != 0)
	{
		r = a % b;
		a = b;
		b = r;
	}
	cout << a;
}

1089

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int a, b, c;
	for (int i = 100; i <= 999; i++)
	{
		a = i / 100;
		b = i % 100 / 10;
		c = i % 100 % 10;
		if (!(a == b || b == c||a==c))
		{
			if (b > a + c)
			{
				if (a + b != 3 && a + b != 5 && a + b != 7 && a + b != 11 && a + b != 13&& a + b != 17)
				{
					cout << i << endl;
				}
			}
		}
	}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

夏梓乔

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值