제출 #1122027

#제출 시각아이디문제언어결과실행 시간메모리
1122027vjudge1Boarding Passes (BOI22_passes)C++17
0 / 100
2 ms476 KiB
#pragma optimize ("g",on)
#pragma GCC optimize("inline")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC optimize ("03")
 
#include <bits/stdc++.h>
 
#define file(s) freopen(s".in", "r", stdin); freopen(s".out", "w", stdout);
#define adiyer(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define bitcount(n) __builtin_popcountll(n)
#define ent (i == n ? '\n' : ' ')
#define all(x) x.begin(), x.end()
#define md ((l + r) >> 1)
#define rv(v) ((v << 1) | 1)
#define lv(v) (v << 1)
#define rs(v) rv(v), md + 1, r
#define ls(v) lv(v), l, md
#define len(s) (int) s.size()
 
#define pb push_back
#define S second
#define F first
 
// #define int long long
 
using namespace std;
 
typedef long long ll;
typedef long double ldb;
typedef vector < ll > vll;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
 
const int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
const int dy[8] = {0, 1, 0, -1, -1, 1, -1, 1};
const int N = 2e5 + 11;
const int mod = 998244353;
const int mod2 = 1e9 + 7;
const ll inf = 1e18 + 10;
const double eps = 1e-9;
 
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
 
ll n;

double res, f[N];

string s;

ll cnk(ll n, ll k){
    return f[n] / f[k] / f[n - k];
}

void output(){
	cin >> s, n = len(s), s = "#" + s, f[0] = 1;
    for(ll i = 1; i <= n; i++) f[i] = f[i - 1] * i;
    for(ll i = 1; i <= (n + 1) / 2; i++){
        ll cur = 0;
        for(ll j = 0; j < i; j++){
            cur += cnk(i - 1, j) * j * f[j];
        }
        res += cur * 1.0 / f[i];
    }
    for(ll i = 1; i <= n / 2; i++){
        ll cur = 0;
        for(ll j = 0; j < i; j++){
            cur += cnk(i - 1, j) * j * f[j];
        }
        res += cur * 1.0 / f[i];
    }
    cout << res;
}
       
const bool cases = 0;
 
signed main(){
//  file("abbreviation");
    adiyer();
    int tt = 1;
    if(cases) cin >> tt;
    for(int i = 1; i <= tt; i++){
//      cout << "Case " << i << ":\n";
        output();
    }
}

컴파일 시 표준 에러 (stderr) 메시지

passes.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    1 | #pragma optimize ("g",on)
      |
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...