/ Randle /

记录详情

Wrong Answer


  
# 状态 耗时 内存占用
#1 Wrong Answer 2ms 364.0 KiB
#2 Wrong Answer 3ms 368.0 KiB
#3 Wrong Answer 3ms 352.0 KiB
#4 Wrong Answer 3ms 368.0 KiB
#5 Wrong Answer 1ms 360.0 KiB
#6 Wrong Answer 1ms 364.0 KiB
#7 Wrong Answer 3ms 344.0 KiB
#8 Wrong Answer 3ms 368.0 KiB
#9 Wrong Answer 3ms 376.0 KiB
#10 Wrong Answer 3ms 360.0 KiB

代码

#include<bits/stdc++.h>
using namespace std;
int a[200],t=0;
inline const void read(int *a)
{
	char c=getchar();
	while(c>='0'&&c<='9')
	{
		a[++t]=c-'0';
		c=getchar();
	}
}
int main()
{
	//freopen("s.in.txt","r",stdin);
	read(a);
	a[t]--;
	int k=t;
	while(true)
	{
		if(a[k]<0)
		{
			a[k]+=10;
			a[k-1]--;
			k--;
		}
		else break;	
	}
	//cout<<"t="<<t<<endl;
	int l=1;
	while(!a[l]) l++;
	int r=l;
	while(r<=t)
	{
		a[r+1]+=10*(a[r]%2);
		a[r]=a[r]/2;
		r++;
	}
	bool w=false;
	//cout<<"l="<<l<<" t="<<t<<endl;
	for(int i=l;i<=t;i++)
	{//cout<<"*"<<endl;
		if(!w&&a[i])
		{
	    	w=true;
	    	cout<<a[i];
	    }
		else
		if(w)
		cout<<a[i];
	}
	cout<<endl;
	return 0;
}

信息

递交者
类型
递交
题目
整除 T2
题目数据
下载
语言
C++
递交时间
2017-10-12 18:58:13
评测时间
2017-10-12 18:58:13
评测机
分数
0
总耗时
29ms
峰值内存
376.0 KiB