제출 #730173

#제출 시각아이디문제언어결과실행 시간메모리
730173danikoynov비스킷 담기 (IOI20_biscuits)C++14
0 / 100
1069 ms340 KiB
#include "biscuits.h"
#include<bits/stdc++.h>

using namespace std;
typedef long long ll;

int n, b[100];
long long count_tastiness(long long x, vector<long long> a)
{
    n = a.size();
    ll sum = 0;
    for (int i = 0; i < n; i ++)
    {
        sum += a[i] * ((ll)(1) << i);
    }

    ll ans = 0;
    for (ll d = 0; d <= sum; d ++)
    {
        for (int i = 0; i < n; i ++)
            b[i] = a[i];

            bool tf = true;
        for (ll bit = 0; bit < 20; bit ++)
        {
            if ((d & (1 << bit)) > 0)
            {
                if (b[bit] < x)
                {
                    tf = false;
                    break;
                }
                b[bit] -= x;
            }
            b[bit + 1] = b[bit + 1] + b[bit] / 2;
        }
        if (tf)
            ans ++;
    }
    cout << ans << endl;

    return ans;
}

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

biscuits.cpp: In function 'long long int count_tastiness(long long int, std::vector<long long int>)':
biscuits.cpp:20:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   20 |         for (int i = 0; i < n; i ++)
      |         ^~~
biscuits.cpp:23:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   23 |             bool tf = true;
      |             ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...