AtCoder Grand Contest 011

Submission #1359308

Source codeソースコード

using namespace std;
const double PI=acos(-1);
typedef long long ll;
typedef pair<int,int> pi;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define rep(i,a,b) for (int i=(a);i<=(b);i++)
#define per(i,a,b) for (int i=(a);i>=(b);i--)
#define Rep(i,a,b) for (int i=(a);i<(b);i++)
#define Per(i,a,b) for (int i=(a);i>(b);i--)
#define deb printf("begin\n");
#define dee printf("end\n");
#define def printf("find\n");
#define dey printf("Yes\n");
#define den printf("No\n");
#define dew printf("wrong\n");
void read(int&x){
	x=0;int f=1;char ch=getchar();
	while ((ch<'0'||ch>'9')&&ch!='-')ch=getchar();
	if (ch=='-')f=-1,ch=getchar();
	while (ch>='0'&&ch<='9')x=x*10+ch-'0',ch=getchar();

#define maxn 500005
char s[maxn];int n,nxt[maxn];
int main(){
	//freopen("Increasing Numbers.out","w",stdout);
	scanf("%s",s+1);n=strlen(s+1);int sum=0;
	nxt[n]=n+1;per(i,n-1,1)if (s[i]==s[i+1])nxt[i]=nxt[i+1];else nxt[i]=i+1;
		int j=nxt[i];
		if (j==n){
			if ((((s[i]-'0'+10-sum%10)%10)==1)&&(((s[n]-'0'+10-sum%10)%10)==0)){sum+=10;break;}
		if (j>n){sum+=((s[i]-'0'+10-sum%10)%10);/*printf("%d\n",s[i]-'0'+10-sum%10);*/break;}
		else if (s[i]<s[j])sum+=((s[i]-'0'+10-sum%10)%10);
		else sum+=((s[i]-'0'+9-sum%10)%10);
	printf("%d\n",(sum+8)/9);return 0;


Task問題 E - Increasing Numbers
User nameユーザ名 Dream_Reality
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1650 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Compiler messageコンパイルメッセージ

./Main.cpp: In function ‘int main()’:
./Main.cpp:43:17: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
scanf("%s",s+1);n=strlen(s+1);int sum=0;

Test case


Set name Score得点 / Max score Cases
Sample - sample1.txt,sample2.txt,sample3.txt,sample4.txt
All 0 / 1300 sample1.txt,sample2.txt,sample3.txt,sample4.txt,in1.txt,in10.txt,in11.txt,in12.txt,in13.txt,in14.txt,in15.txt,in16.txt,in17.txt,in18.txt,in19.txt,in2.txt,in20.txt,in21.txt,in22.txt,in23.txt,in24.txt,in25.txt,in26.txt,in27.txt,in28.txt,in29.txt,in3.txt,in30.txt,in31.txt,in4.txt,in5.txt,in500000.txt,in6.txt,in7.txt,in8.txt,in9.txt,sample1.txt,sample2.txt,sample3.txt,sample4.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
in1.txt WA
in10.txt WA
in11.txt AC 3 ms 2560 KB
in12.txt WA
in13.txt WA
in14.txt WA
in15.txt WA
in16.txt WA
in17.txt WA
in18.txt WA
in19.txt WA
in2.txt WA
in20.txt WA
in21.txt WA
in22.txt WA
in23.txt WA
in24.txt WA
in25.txt WA
in26.txt WA
in27.txt WA
in28.txt WA
in29.txt WA
in3.txt WA
in30.txt WA
in31.txt WA
in4.txt WA
in5.txt WA
in500000.txt WA
in6.txt WA
in7.txt WA
in8.txt WA
in9.txt WA
sample1.txt AC 1 ms 128 KB
sample2.txt AC 1 ms 128 KB
sample3.txt AC 1 ms 128 KB
sample4.txt AC 1 ms 128 KB