QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#691778#6706. SekiroKdlyh#AC ✓1ms3664kbC++201.9kb2024-10-31 12:58:382024-10-31 12:58:39

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 12:58:39]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3664kb
  • [2024-10-31 12:58:38]
  • 提交

answer

#include <cassert>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
#include <stack>

#ifdef LOCAL
template <class T, size_t size = std::tuple_size<T>::value> std::string to_debug(T, std::string s = "") requires(not std::ranges::range<T>);
std::string to_debug(auto x) requires requires(std::ostream& os) { os << x; } { return static_cast<std::ostringstream>(std::ostringstream() << x).str(); }
std::string to_debug(std::ranges::range auto x, std::string s = "") requires(not std::is_same_v<decltype(x), std::string>) {
  for (auto xi : x) { s += ", " + to_debug(xi); }
  return "[" + s.substr(s.empty() ? 0 : 2) + "]";
}
template <class T, size_t size> std::string to_debug(T x, std::string s) requires(not std::ranges::range<T>) {
  [&]<size_t... I>(std::index_sequence<I...>) { ((s += ", " + to_debug(get<I>(x))), ...); }(std::make_index_sequence<size>());
  return "(" + s.substr(s.empty() ? 0 : 2) + ")";
}
#define debug(...) std::cerr << __LINE__ << ": (" #__VA_ARGS__ ") = " << to_debug(std::tuple(__VA_ARGS__)) << "\n"
#else
#define debug(x...)
#endif

using i64 = long long;
#define int long long

void solve()
{
#define tests
    int n, k; std::cin >> n >> k;
    k = std::min(k, 40LL);
    while (n and k > 0) {
        n = (n + 1) / 2; k -= 1;
    }
    std::cout << n << "\n";
}
 
signed main()
{
    std::cin.tie(nullptr)->sync_with_stdio(false);
    int _{1};
#ifdef tests
    std::cin >> _;
#endif
    while(_--) solve();
    return 0;
}


这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3580kb

input:

4
10 1
7 1
10 2
7 2

output:

5
4
3
2

result:

ok 4 number(s): "5 4 3 2"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

1000
442956297 12
982332962 27
497083098 816382285
396247623 24
898041447 407271792
763055147 14
352462601 16
519828345 6
219558285 10
325702476 354976208
490357788 107179876
390383594 636902929
169308923 21552242
657869544 9
435305129 833496936
300697250 24
320657401 4
896954688 877519779
679896094...

output:

108144
8
1
24
1
46574
5379
8122318
214413
1
1
1
1
1284902
1
18
20041088
1
21246753
5480
553
226
3877013
3162838
1
1
0
330619747
1168178
1
10463
1
2
0
1
0
1
1
91795
22918685
0
364
26026
66
1
4
15291
1
1
10
0
35435061
1
1
13899
1
6616
1
117
1
30576
1
1
101267710
1
1
4428
1
37192038
620
1
0
11
3551
1
4...

result:

ok 1000 numbers