东方博弈OJ/1081~1100解析

1081

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	printf("%02d:%02d:%02d",n/3600,n%3600/60,n%60);
	return 0;
}

1082

#include <bits/stdc++.h>
using namespace std;
int day(int i){
	if(i==10){
		return 1;
	}else{
		return (day(i+1)+1)*2;
	}
}
int main()
{
	cout<<day(1);
	return 0;
}

1083

#include <bits/stdc++.h>
using namespace std;
bool huiwen(int n)
{
	int k=n;
	int t=0;
	while(n)
{
		t = t*10+n%10;
		n/=10;
	}
	if(t==k)
{
		return true;
	}else{
		return false;
	}
	
}
int main()
{
	int n,cnt=0,t=0,sum=0,k;
	cin>>n;
	while(!huiwen(n))
{
		k=n;
		t=0;
		while(k)
{
		t = t*10+k%10;
		k/=10;
		}
		n=t+n;
		cnt++;
	}
	cout<<cnt;
    return 0;
}

1084

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

1085

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int x,y;
	for(int i=1000;i<=9999;i++)
{
		x = i/100;
		y = i%100;
		if((x+y)*(x+y)==i)
{
			cout<<i<<endl;
		}
	}

	return 0;
}

1086

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

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;
	return 0;
}

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;
	return 0;
}

1089

#include <bits/stdc++.h>
using namespace std;
bool zhishu(int n)
{
	int flag=0;
	for(int i=2;i<=sqrt(n);i++)
{
		if(n%i==0)
{
			flag = 1;
			break;
		}
	}
	if(flag==0)
{
		return true; 
	} 
else
{
		return false;
	}
	 
}
int main()
{
	int a,b,c;
	for(int i=100;i<=999;i++)
{
		a = i/100;
        b = i%100/10;
		c = i%10;
		if(b>a+c && !zhishu(a+b) && a!=b && a!=c&& c!=b)
{
			cout<<i<<endl;
		}
	}
	return 0;
}

1090

 

#include <bits/stdc++.h>
using namespace std;
int main()
{
	for(int i=42;i<=1000;i++)
{
		
		if(i%42==0)
{
			cout<<i<<endl;
		}
	}
    return 0;
}

1091

 

#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,sumji=0,sumou=0;
	cin>>n;
	for(int i=1;i<=n;i++)
{
		
		if(i%2==0)
{
			sumou+=i;
		}else{
			sumji+=i;
		}
	}
	cout<<sumji<<" "<<sumou;
	return 0;
}

1092

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

 

  • 3
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值