結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー nanasili
提出日時 2015-07-31 22:39:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 695 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 81,880 KB
実行使用メモリ 43,924 KB
最終ジャッジ日時 2024-07-16 20:54:09
合計ジャッジ時間 7,061 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other TLE * 1 -- * 29
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:29:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   29 |   scanf("%lld %lld", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~
main.cpp:38:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   38 |     scanf("%lld", &r);
      |     ~~~~~^~~~~~~~~~~~
main.cpp:42:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   42 |     scanf("%lld", &r);
      |     ~~~~~^~~~~~~~~~~~

ソースコード

diff #

#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;


int main() {
  ll n, k;
  scanf("%lld %lld", &n, &k);
  if (n-1 <= k) {
    printf("%lld\n", n-1);
    return 0;
  }

  ll r = 0;
  if (n%(k+1) == 1) {
    puts("0");
    scanf("%lld", &r);
  }
  while (r < n) {
    printf("%lld\n", (r+k)/(k+1)*(k+1));
    scanf("%lld", &r);
  }
}
0