結果

問題 No.477 MVP
ユーザー Imperi_NightImperi_Night
提出日時 2018-08-18 14:41:54
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 363 bytes
コンパイル時間 336 ms
コンパイル使用メモリ 51,596 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-23 13:55:51
合計ジャッジ時間 890 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 0 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 0 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:17: warning: format ‘%u’ expects argument of type ‘unsigned int*’, but argument 2 has type ‘long int*’ [-Wformat=]
   13 |         scanf("%u %u", &N, &K);
      |                ~^      ~~
      |                 |      |
      |                 |      long int*
      |                 unsigned int*
      |                %lu
main.cpp:13:20: warning: format ‘%u’ expects argument of type ‘unsigned int*’, but argument 3 has type ‘long int*’ [-Wformat=]
   13 |         scanf("%u %u", &N, &K);
      |                   ~^       ~~
      |                    |       |
      |                    |       long int*
      |                    unsigned int*
      |                   %lu
main.cpp:16:34: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
   16 |                         printf("%d", i);
      |                                 ~^   ~
      |                                  |   |
      |                                  int long int
      |                                 %ld
main.cpp:13:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |         scanf("%u %u", &N, &K);
      |         ~~~~~^~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <cstdio>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>

#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)

using namespace std;

int main(){
	long int N, K;
	scanf("%u %u", &N, &K);
	for (long int i = ceil((N-K)/(K+1)); i < N/2+2; i++) {
		if (i > (long int) floor((N - i) / K)) {
			printf("%d", i);
			return 0;
		}
	}
	return 0;
}
0