Submission #2143261


Source Code Expand

Copy
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<queue>
#include<deque>
#include<stack>
#include<string>
#include<string.h>
#include<vector>
#include<set>
#include<map>
#include<bitset>
#include<stdlib.h>
#include<cassert>
#include<time.h>
#include<bitset>
using namespace std;
const long long mod=1000000007;
const long long inf=mod*mod;
const long long d2=(mod+1)/2;
const double EPS=1e-6;
const double PI=acos(-1.0);
int ABS(int a){return max(a,-a);}
long long ABS(long long a){return max(a,-a);}
double ABS(double a){return max(a,-a);}
char in[1100];
int main(){
	scanf("%s",in);
	int n=strlen(in);
	int con=0;
	for(int i=0;i<n;i++){
		if(i&&in[i]==in[i-1])con++;
		else con=1;
		if(i==n-1||in[i]!=in[i+1]){
			printf("%c%d",in[i],con);
		}
	}
	printf("\n");
}

Submission Info

Submission Time
Task B - 高橋くんと文字列圧縮
User tozangezan
Language C++14 (GCC 5.4.1)
Score 100
Code Size 817 Byte
Status
Exec Time 1 ms
Memory 128 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:28:16: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",in);
                ^

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0 subtask0_1.txt, subtask0_2.txt, subtask0_3.txt
All 100 / 100 0.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, 2.txt, 20.txt, 21.txt, 22.txt, 23.txt, 24.txt, 25.txt, 26.txt, 27.txt, 28.txt, 29.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, subtask0_1.txt, subtask0_2.txt, subtask0_3.txt
Case Name Status Exec Time Memory
0.txt 1 ms 128 KB
1.txt 1 ms 128 KB
10.txt 1 ms 128 KB
11.txt 1 ms 128 KB
12.txt 1 ms 128 KB
13.txt 1 ms 128 KB
14.txt 1 ms 128 KB
15.txt 1 ms 128 KB
16.txt 1 ms 128 KB
17.txt 1 ms 128 KB
18.txt 1 ms 128 KB
19.txt 1 ms 128 KB
2.txt 1 ms 128 KB
20.txt 1 ms 128 KB
21.txt 1 ms 128 KB
22.txt 1 ms 128 KB
23.txt 1 ms 128 KB
24.txt 1 ms 128 KB
25.txt 1 ms 128 KB
26.txt 1 ms 128 KB
27.txt 1 ms 128 KB
28.txt 1 ms 128 KB
29.txt 1 ms 128 KB
3.txt 1 ms 128 KB
4.txt 1 ms 128 KB
5.txt 1 ms 128 KB
6.txt 1 ms 128 KB
7.txt 1 ms 128 KB
8.txt 1 ms 128 KB
9.txt 1 ms 128 KB
subtask0_1.txt 1 ms 128 KB
subtask0_2.txt 1 ms 128 KB
subtask0_3.txt 1 ms 128 KB