結果
| 問題 | 
                            No.257 N言っちゃダメゲーム (3)
                             | 
                    
| コンテスト | |
| ユーザー | 
                             nanasili
                         | 
                    
| 提出日時 | 2015-07-31 23:04:16 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                            (最新)
                                AC
                                 
                             
                            (最初)
                            
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 721 bytes | 
| コンパイル時間 | 725 ms | 
| コンパイル使用メモリ | 82,128 KB | 
| 実行使用メモリ | 43,664 KB | 
| 最終ジャッジ日時 | 2024-07-16 20:56:55 | 
| 合計ジャッジ時間 | 7,156 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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:43:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   43 |     scanf("%lld", &r);
      |     ~~~~~^~~~~~~~~~~~
            
            ソースコード
#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);
  }
  ll p = (n-1)%(k+1);
  while (r < n) {
    printf("%lld\n", (r+k-p)/(k+1)*(k+1)+p);
    scanf("%lld", &r);
  }
}
            
            
            
        
            
nanasili