您当前的位置: 首页 > 

对方正在debug

暂无认证

  • 2浏览

    0关注

    399博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Educational Codeforces Round 66 (Rated for Div. 2)

对方正在debug 发布时间:2019-06-08 23:39:21 ,浏览量:2

原题链接:http://codeforces.com/contest/1175

A From Hero to Zero
#include
using namespace std;
#define ll long long

ll n,k,ans;
int main()
{
	ans;
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%I64d%I64d",&n,&k);
		ans=0;
		while(n){
			while(n%k==0){
				n/=k;
				ans++;
			}
			//printf("n:%d cur:%I64d\n",n,ans);//
			ans+=n%k;
			n-=n%k;
		}
		printf("%I64d\n",ans);
	}
	return 0;
}
B Catch Overflow!

题意:有三种读入for d 、end、 add,分别代表循环次数、循环终止、加1,开始值为0,求t次操作后值大小。

#include
using namespace std;
#define ll long long

ll n,k,x;
char s[110];
int main()
{
	int t;
	scanf("%d",&t);
	ll ans=0,limit=(1LLlimit){
				flag=0;continue;
			}
			ans+=cur;
		}
	}
	if(!flag)
		printf("OVERFLOW!!!\n");
	else
		printf("%I64d\n",ans);
	return 0;
}
C - Electrification

题意:给n个数ai(升序排序),令di=|ai-x| sort d后取第k+1小做为fk(x),求min{fk(x)} 题解:从左到右枚举每k+1个数,取中间位置就是我们的fk(x),取得到的所有fk(x)最小的那个对应的下标即可。

#include
using namespace std;
#define ll long long
const int maxn=300010;

int a[maxn];
int n,k;

int main()
{
	int t;
	scanf("%d",&t);
	while(t--){
		scanf("%d%d",&n,&k);
		for(int i=1;i            
关注
打赏
1664895754
查看更多评论
0.0882s