2017年多校联合训练 第七场(杭二中)

官方题解

1005 Euler theorem
hdoj6124题目链接
//比赛的时候一看过得这么多,不思考了,打表过233
b的取值为[0,a/2)U{a}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t,a;
    scanf("%d",&t);
    while(t--) scanf("%d",&a),printf("%d\n",(a+1)/2+1);
}

1010 Just do it
三种方法加详解:
http://blog.csdn.net/qyqyqyqyq/article/details/77239319

1011 Kolakoski
hdoj6130题目链接
只要读懂题意(Kolakoski序列的生成方式)就好做了,模拟,复杂度O(n)

#include<bits/stdc++.h>
using namespace std;
#define N 10000005
int t,a[N],now,pos,i,n;
int main()
{
    scanf("%d",&t);
    for(a[1]=1,a[2]=2,now=1,pos=2,i=3;i<N;i++)
        if(now==a[pos]) a[i]=3-a[i-1],pos++,now=1;
        else a[i]=a[i-1],now++;
    while(t--) scanf("%d",&n),printf("%d\n",a[n]);
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值