QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#684190 | #9430. Left Shifting 2 | Akoasm_X | WA | 2ms | 3764kb | C++20 | 1.2kb | 2024-10-28 11:11:06 | 2024-10-28 11:11:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define int long long
#define endl "\n"
typedef long long LL;
inline int read(){
int x = 0 , f = 1 ; char c = getchar() ;
while( c < '0' || c > '9' ) { if( c == '-' ) f = -1 ; c = getchar() ; }
while( c >= '0' && c <= '9' ) { x = x * 10 + c - '0' ; c = getchar() ; }
return x * f ;
}
const int maxn = 5e5+20;
int n;
char s1[maxn],s2[maxn];
void solve(int T){
scanf("%s",s1);
n = strlen(s1);
for(int i=0;i<n;i++) s2[i] = s1[i];
int ans = 0;
for(int i=1;i<n;i++){
if(s1[i]==s1[i-1]){
for(int j=0;i+j<n;j++) s2[j] = s1[i+j];
for(int j=0;j<i;j++) s2[n-i+j] = s1[j];
break;
}
}
// for(int i=0;i<n;i++) cout<<s2[i];
for(int i=1;i<n;i++){
if(s2[i]==s2[i-1]){
i++;
ans++;
}
}
// cout<<s2<<endl;
// cout<<ans<<endl;
// printf("%s\n",s2);
printf("%d\n",ans);
}
signed main(){
// ios::sync_with_stdio(0);
// cin.tie(0);cout.tie(0);
// freopen("1.txt","r",stdin);
int T = 1;
T = read();
// cin>>T;
while(T--) solve(T);
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3764kb
input:
3 abccbbbbd abcde x
output:
2 0 0
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 2ms
memory: 3740kb
input:
5000 lfpbavjsmppdppkfwnyfmbdhptdswsoulrbhyjh cfliuqnynejgnxolzbdoztclzbozqomvioszk eiivcoqoymonrqgrjdtkts mdcvservaxcbioopfungsgkiftchwlmtbzqgaraovjknsgiegkvdbolmeunvrxrpscnf ujeqtidwtoikkqtygo llma qjfvgwrdhaazejsfgilnpmmhkefndzvyon kzwwpdpbrudqmwmjscllnnjyoepxophcoopvfepikouinuxx vftculoorxskpkxoz...
output:
1 0 0 0 0 0 1 4 0 0 1 1 1 1 2 3 1 0 5 6 0 0 5 2 0 1 3 2 0 3 0 1 0 1 1 0 1 4 1 3 1 0 1 5 3 0 3 0 0 1 8 1 0 6 1 2 0 1 0 0 4 1 2 4 3 1 3 2 3 1 2 1 0 0 2 0 3 2 0 4 0 5 5 0 3 0 4 1 0 2 1 0 3 0 1 6 1 2 1 3 3 3 5 2 3 0 3 5 2 3 0 0 3 0 4 6 3 2 1 1 0 0 2 0 1 1 3 3 3 1 2 0 1 1 4 3 1 3 1 1 1 2 0 1 2 0 4 0 2 1 ...
result:
wrong answer 15th lines differ - expected: '1', found: '2'