Submission #1241253


Source Code Expand

#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <cctype>
#define rep(i, m, n) for(int i = m;i < n;i++)
#define repr(i, n) for(int i = n;i >= 0;i--)
#define ll long long
#define ull unsigned long long
#define push(a) push_back(a)
#define pop(a) pop_back(a)
#define debug(x) cout<<#x<<": "<<x<<endl
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  int in1=1e9, in2=0;
  string s;
  cin >> s;
  rep(i,0,s.size()){
    if(s[i] == 'A'){
      in1 = min(in1, i);
    }
    if(s[i] == 'Z'){
      in2 = max(in2, i);
    }

  }
  cout << in2-in1+1 << endl;
}

Submission Info

Submission Time
Task B - A to Z String
User thedekopin0108
Language C++14 (GCC 5.4.1)
Score 200
Code Size 906 Byte
Status AC
Exec Time 9 ms
Memory 640 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 12
Set Name Test Cases
Sample 00_example_01.txt, 00_example_02.txt, 00_example_03.txt
All 00_example_01.txt, 00_example_02.txt, 00_example_03.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt
Case Name Status Exec Time Memory
00_example_01.txt AC 1 ms 256 KB
00_example_02.txt AC 1 ms 256 KB
00_example_03.txt AC 1 ms 256 KB
01.txt AC 7 ms 640 KB
02.txt AC 6 ms 640 KB
03.txt AC 4 ms 512 KB
04.txt AC 4 ms 512 KB
05.txt AC 8 ms 640 KB
06.txt AC 8 ms 640 KB
07.txt AC 8 ms 640 KB
08.txt AC 9 ms 640 KB
09.txt AC 9 ms 640 KB