Contest Duration: - (local time) (120 minutes) Back to Home

Submission #169502

Source Code Expand

Copy
```/*
* Title:C - コイン
* abc008c.cpp
*  Created on: 2014/05/10
*      Author: kyave
*/

#include <iostream>
#include <stdio.h>
#include <sstream>
#include <string>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>

using namespace std;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

typedef long long ll;
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define REP(i,n) FOR(i,0,n)
#define pb push_back
#define fs first
#define se second
#define mp make_pair
#define INF 1 << 29

int main(){
int n;
cin >> n;

vector<int> c;
REP(i,n){
int t;
cin >> t; c.pb(t);
}

ll sum = 0;
ll count = 0;
do {
count++;
int coin[100];
fill(coin,coin+100,1);
REP(i,n) {
int pos = c[i];
FOR(j,i+1,n) {
if(c[j] >= pos && c[j]%pos == 0 )
coin[j]*=-1;
}
}
REP(i,n) {
if(coin[i]==1) sum+=1;
}
}
while( next_permutation(c.begin(), c.end()));

printf("%12f\n",(double)sum/count);

return 0;
}
```

#### Submission Info

Submission Time 2014-05-10 22:04:00+0900 C - コイン Nokotan C++ (G++ 4.6.4) 0 1284 Byte WA 2035 ms 928 KB

#### Judge Result

Score / Max Score 0 / 0 0 / 99 0 / 1
Status
 AC × 2 WA × 1
 AC × 10 WA × 10
 AC × 12 WA × 10 TLE × 18
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 20 ms 916 KB
sample_02.txt AC 21 ms 800 KB
sample_03.txt WA 21 ms 808 KB
subtask1_01.txt AC 20 ms 924 KB
subtask1_02.txt AC 22 ms 804 KB
subtask1_03.txt WA 22 ms 928 KB
subtask1_04.txt AC 35 ms 800 KB
subtask1_05.txt WA 32 ms 800 KB
subtask1_06.txt AC 21 ms 800 KB
subtask1_07.txt AC 33 ms 796 KB
subtask1_08.txt WA 20 ms 800 KB
subtask1_09.txt WA 20 ms 924 KB
subtask1_10.txt AC 34 ms 924 KB
subtask1_11.txt WA 21 ms 924 KB
subtask1_12.txt AC 33 ms 920 KB
subtask1_13.txt AC 22 ms 920 KB
subtask1_14.txt AC 22 ms 788 KB
subtask1_15.txt WA 24 ms 796 KB
subtask1_16.txt AC 22 ms 920 KB
subtask1_17.txt WA 23 ms 928 KB
subtask1_18.txt WA 21 ms 800 KB
subtask1_19.txt WA 28 ms 796 KB
subtask1_20.txt WA 30 ms 924 KB
subtask2_01.txt AC 1608 ms 796 KB
subtask2_02.txt AC 20 ms 924 KB
subtask2_03.txt TLE 2035 ms 788 KB
subtask2_04.txt TLE 2029 ms 812 KB
subtask2_05.txt TLE 2028 ms 808 KB
subtask2_06.txt TLE 2028 ms 884 KB
subtask2_07.txt TLE 2033 ms 812 KB
subtask2_08.txt TLE 2028 ms 884 KB
subtask2_09.txt TLE 2028 ms 924 KB
subtask2_10.txt TLE 2029 ms 796 KB
subtask2_11.txt TLE 2028 ms 884 KB
subtask2_12.txt TLE 2028 ms 928 KB
subtask2_13.txt TLE 2029 ms 872 KB
subtask2_14.txt TLE 2029 ms 800 KB
subtask2_15.txt TLE 2029 ms 804 KB
subtask2_16.txt TLE 2028 ms 800 KB
subtask2_17.txt TLE 2029 ms 800 KB
subtask2_18.txt TLE 2029 ms 928 KB
subtask2_19.txt TLE 2029 ms 884 KB
subtask2_20.txt TLE 2029 ms 812 KB