题目1006:ZOJ问题
#include <stdio.h>
#include <iostream>
#include <stack>
#include <string.h>
#include <queue>
#include <cmath>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <string>
using namespace std;
typedef long long LL;
int ans[1000000];
int main() {
//freopen("in.txt", "r", stdin);
//freopen("out.txt", "w", stdout);
string str;
while(cin >> str) {
int pos_z = str.find('z');
int pos_j = str.find('j');
int num_z = 0, num_j = 0;
//cout << pos_z << " " << pos_j << endl;
for(int i = 0; i < str.size(); i++){
if(str[i] == 'z'){
num_z++;
}
if(str[i] == 'j'){
num_j++;
}
}
if(pos_z * (pos_j - 1 - pos_z) == str.size() - 1 - pos_j && num_z == 1 && num_j == 1 && pos_j - pos_z > 1){
cout << "Accepted" << endl;
}else {
cout << "Wrong Answer" << endl;
}
}
return 0;
}
/**************************************************************
Problem: 1006
User: Crazy_man
Language: C++
Result: Accepted
Time:80 ms
Memory:5424 kb
****************************************************************/