結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー xxxasdfghjkxxxasdfghjk
提出日時 2018-10-08 17:53:32
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,242 bytes
コンパイル時間 2,176 ms
コンパイル使用メモリ 144,728 KB
実行使用メモリ 24,468 KB
平均クエリ数 2.03
最終ジャッジ日時 2023-09-23 16:25:11
合計ジャッジ時間 4,904 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 45 ms
24,012 KB
testcase_06 AC 45 ms
24,240 KB
testcase_07 AC 41 ms
23,436 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define MAX_N 100001
#define INF_INT 2147483647
#define INF_LL 9223372036854775807
#define REP(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef pair<ll,ll> P;
void init(int n);
int find(int n);
void unite(int x,int y);
bool same(int x, int y);
ll bpow(ll,ll,ll);
typedef vector<int> vec;
typedef vector<vec> mat;
mat mul(mat &A,mat &B);
mat pow(mat A,ll n);
int dx[4] = {1,0,0,-1};
int dy[4] = {0,1,-1,0};


bool cmp_P(const P &a,const P &b){
  return a.second < b.second;
}

ll gcd(ll a,ll b){
  if(b == 0)return a;
  else return gcd(b,a%b);
}

ll bpow(ll a, ll n,ll mod){
  int i = 0;
  ll res=1;
  while(n){
    if(n & 1)
      res = (res*a) % mod;
    a = (a*a) % mod;
    n >>= 1;
  }
  return res;
}

int main()
{
  ll N,NN,K;
  cin >> N >> K;
  NN = N;
  if(N%(K+1) == 1){
    cout << 0 << endl;
  }else{
    int d = N%(K+1);
    if(d == 0){
      cout << K << endl;
      N-=K;
    }else{
      cout << d-1 << endl;
      N-= d-1;
    }
  }
  int L;
  while(1){
    cin >> L;
    if(L >= NN)
      return 0;
    N-=L;
    int d = N%(K+1);
    if(d == 0){
      cout << K << endl;
      N-=K;
    }else{
      cout << d-1 << endl;
      N -= d-1;
    }
  }
  return 0;
}

0