AtCoder Beginner Contest 008

Submission #7475314

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define all(x) (x).begin(),(x).end()
ll tmp1,tmp2,tmp3;
const ll mod = 1e9+7;
const int INF = 1e9;
const ll INFLONG = 1e18;
void swap(ll *x,ll *y){
  ll z = *x;
  *x = *y;
  *y = z;
}
void print(vector<ll> vec){
  ll length = (ll)vec.size();
  rep(i,length){
    if(i != 0){cout << " ";}
    cout << vec[i];
  }
  cout << endl;
}

int main(){
  ll n;
  cin >> n;
  vector<ll> vec(n);
  vector<ll> pres(n,-1);
  rep(i,n){
    cin >> vec[i];
  }
  sort(all(vec));
  rep(i,n){
    rep(j,n){
      if(vec[i] % vec[j] == 0){
        pres[i]++;
      }
    }
  }
  double sum = 0;
  double tmp;
  rep(i,n){
    cout << i << " " << pres[i] << endl;
    if(pres[i] == 0){
      sum++;
    }else{
      tmp = (double)(pres[i] / 2) + 1;
      //cout << tmp;
      sum += (tmp / (pres[i]+1));
    }
  }
  printf("%.10f\n",sum);
}

Submission

Task問題 C - コイン
User nameユーザ名 ojiso
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 1283 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt
Subtask1 0 / 99 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_20.txt
Subtask2 0 / 1 subtask1_01.txt,subtask1_02.txt,subtask1_03.txt,subtask1_04.txt,subtask1_05.txt,subtask1_06.txt,subtask1_07.txt,subtask1_08.txt,subtask1_09.txt,subtask1_10.txt,subtask1_11.txt,subtask1_12.txt,subtask1_13.txt,subtask1_14.txt,subtask1_15.txt,subtask1_16.txt,subtask1_17.txt,subtask1_18.txt,subtask1_19.txt,subtask1_20.txt,subtask2_01.txt,subtask2_02.txt,subtask2_03.txt,subtask2_04.txt,subtask2_05.txt,subtask2_06.txt,subtask2_07.txt,subtask2_08.txt,subtask2_09.txt,subtask2_10.txt,subtask2_11.txt,subtask2_12.txt,subtask2_13.txt,subtask2_14.txt,subtask2_15.txt,subtask2_16.txt,subtask2_17.txt,subtask2_18.txt,subtask2_19.txt,subtask2_20.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt WA
sample_02.txt WA
sample_03.txt WA
subtask1_01.txt WA
subtask1_02.txt WA
subtask1_03.txt WA
subtask1_04.txt WA
subtask1_05.txt WA
subtask1_06.txt WA
subtask1_07.txt WA
subtask1_08.txt WA
subtask1_09.txt WA
subtask1_10.txt WA
subtask1_11.txt WA
subtask1_12.txt WA
subtask1_13.txt WA
subtask1_14.txt WA
subtask1_15.txt WA
subtask1_16.txt WA
subtask1_17.txt WA
subtask1_18.txt WA
subtask1_19.txt WA
subtask1_20.txt WA
subtask2_01.txt WA
subtask2_02.txt WA
subtask2_03.txt WA
subtask2_04.txt WA
subtask2_05.txt WA
subtask2_06.txt WA
subtask2_07.txt WA
subtask2_08.txt WA
subtask2_09.txt WA
subtask2_10.txt WA
subtask2_11.txt WA
subtask2_12.txt WA
subtask2_13.txt WA
subtask2_14.txt WA
subtask2_15.txt WA
subtask2_16.txt WA
subtask2_17.txt WA
subtask2_18.txt WA
subtask2_19.txt WA
subtask2_20.txt WA