Submission #17943


Source Code Expand

Copy
// compile with "g++ XXX.cc -mno-cygwin -O2" in Cygwin

#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<numeric>
#include<functional>
#include<complex>
#include<bitset>
#include<cassert>

using namespace std;
#define BET(a,b,c) ((a)<=(b)&&(b)<(c))
#define FOR(i,n) for(int i=0,i##_end=(int(n));i<i##_end;i++)
#define FOR3(i,a,b) for(int i=a,i##_end=b;i<i##_end;i++)
#define FOR_EACH(it,v) for(__typeof(v.begin()) it=v.begin(),it_end=v.end() ; it != it_end ; it++)
#define SZ(x) (int)(x.size())
#define ALL(x) (x).begin(),(x).end()
#define MP make_pair
#define CLS(x,val) memset((x) , val , sizeof(x)) 
typedef long long ll_t;
typedef long double ld_t;
typedef vector<int> VI; 
typedef vector<VI> VVI;
typedef complex<int> xy_t;

template<typename T> void debug(T v , string delimiter = "\n")
{ for(__typeof(v.begin()) it=v.begin(),it_end=v.end() ; it != it_end ; it++) cout << *it << delimiter; cout << flush ;}

int dx[]  = {0,1,0,-1};
int dy[]  = {1,0,-1,0};
string ds = "SENW";

const double PI = 4.0*atan(1.0);

int main() {
  int n;
  string s;
  cin>>n>>s;
  double sc = 0;
  FOR(i,SZ(s)){
    if(s[i]=='A') sc+=4;
    if(s[i]=='B') sc+=3;
    if(s[i]=='C') sc+=2;
    if(s[i]=='D') sc+=1;
  }
  printf("%.10f\n" , sc / SZ(s));
  return 0 ;
}

Submission Info

Submission Time
Task A - GPA計算
User EmK
Language C++ (G++ 4.6.4)
Score 100
Code Size 1470 Byte
Status AC
Exec Time 215 ms
Memory 852 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 32
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, 01_rnd_01.txt, 01_rnd_02.txt, 01_rnd_03.txt, 01_rnd_04.txt, 01_rnd_05.txt, 01_rnd_06.txt, 01_rnd_07.txt, 01_rnd_08.txt, 01_rnd_09.txt, 01_rnd_10.txt, 02_rndmax_01.txt, 02_rndmax_02.txt, 02_rndmax_03.txt, 02_rndmax_04.txt, 02_rndmax_05.txt, 02_rndmax_06.txt, 02_rndmax_07.txt, 02_rndmax_08.txt, 02_rndmax_09.txt, 02_rndmax_10.txt, 03_mini_01.txt, 03_mini_02.txt, 03_mini_03.txt, 03_mini_04.txt, 03_mini_05.txt, 04_samemax_01.txt, 04_samemax_02.txt, 04_samemax_03.txt, 04_samemax_04.txt, 04_samemax_05.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 39 ms 788 KB
00_sample_02.txt AC 39 ms 796 KB
01_rnd_01.txt AC 215 ms 784 KB
01_rnd_02.txt AC 24 ms 780 KB
01_rnd_03.txt AC 28 ms 756 KB
01_rnd_04.txt AC 23 ms 776 KB
01_rnd_05.txt AC 110 ms 852 KB
01_rnd_06.txt AC 25 ms 772 KB
01_rnd_07.txt AC 24 ms 780 KB
01_rnd_08.txt AC 24 ms 776 KB
01_rnd_09.txt AC 22 ms 756 KB
01_rnd_10.txt AC 142 ms 784 KB
02_rndmax_01.txt AC 24 ms 852 KB
02_rndmax_02.txt AC 42 ms 780 KB
02_rndmax_03.txt AC 22 ms 752 KB
02_rndmax_04.txt AC 21 ms 776 KB
02_rndmax_05.txt AC 24 ms 752 KB
02_rndmax_06.txt AC 22 ms 772 KB
02_rndmax_07.txt AC 26 ms 780 KB
02_rndmax_08.txt AC 21 ms 780 KB
02_rndmax_09.txt AC 26 ms 788 KB
02_rndmax_10.txt AC 27 ms 784 KB
03_mini_01.txt AC 23 ms 776 KB
03_mini_02.txt AC 21 ms 776 KB
03_mini_03.txt AC 23 ms 784 KB
03_mini_04.txt AC 23 ms 776 KB
03_mini_05.txt AC 23 ms 784 KB
04_samemax_01.txt AC 24 ms 792 KB
04_samemax_02.txt AC 34 ms 848 KB
04_samemax_03.txt AC 25 ms 796 KB
04_samemax_04.txt AC 25 ms 784 KB
04_samemax_05.txt AC 24 ms 788 KB