您当前的位置: 首页 > 

对方正在debug

暂无认证

  • 4浏览

    0关注

    399博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Codeforces Round #565 (Div. 3)

对方正在debug 发布时间:2019-06-11 11:20:28 ,浏览量:4

A Divide it!
#include
using namespace std;
#define ll long long
int main()
{
	int t;
	scanf("%d",&t);
	ll x;
	while(t--){
		scanf("%I64d",&x);
		ll ans=0;
		while(x>1&&x%2==0){
			x/=2;
			ans++;
		}
		while(x>1&&x%3==0){
			x/=3;
			ans+=2;
		}
		while(x>1&&x%5==0){
			x/=5;
			ans+=3;
		}
		if(x>1)
			printf("-1\n");
		else
			printf("%I64d\n",ans);
	}
	return 0;
}
B Merge it!
#include
using namespace std;
#define ll long long

int main()
{
	int t,n,x;
	scanf("%d",&t);
	while(t--){
		int n,a=0,b=0,ans=0;
		scanf("%d",&n);
		while(n--){
			scanf("%d",&x);
			if(x%3==0) ans++;
			else if(x%3==1) a++;
			else b++; 
		}
		if(a>b){
			ans+=b;
			a-=b;
			ans+=a/3;
		}else{
			ans+=a;
			b-=a;
			ans+=b/3;
		}
		printf("%d\n",ans);
	}
	return 0;
}
C Lose it!

题意:求删去最少元素,使得数组可以由多个或一个子序列{4,8,15,16,23,42}组成,子序列可以不连续 题解:2019广东省省赛复现,对于当前元素cur,如果它前一个pre不存在,说明这个元素必删,否则mp[cur]++,mp[pre]–。

#include
using namespace std;
#define ll long long

int a[8]={4,8,15,16,23,42};
int pre[50];
int mp[50];
int main()
{
	int t,n,x;
	pre[8]=4;
	pre[15]=8;
	pre[16]=15;
	pre[23]=16;
	pre[42]=23;
	while(~scanf("%d",&n)){
		int ans=0;
		memset(mp,0,sizeof(mp));
		for(int i=0;i mx[ai]
*/ 
int mx[maxn],Prime[maxn];//2750131
void init()
{
	for(int i=1;i            
关注
打赏
1664895754
查看更多评论
0.0370s