Submission #290823

#TimeUsernameProblemLanguageResultExecution timeMemory
290823gs14004CATS (NOI14_cats)C++17
25 / 25
106 ms8004 KiB
#include <cstdio>
#include <cstring>
using lint = long long;

int main(){
	int q;
	scanf("%d",&q);
	while (q--) {
		lint x, l, n;
		scanf("%lld %lld %lld",&x,&l,&n);
		x--;
		lint Q = l / (2 * n) + 2;
		if(Q <= 61) x %= (1ll << Q);
		printf("%lld\n", (Q - 1) * (2 * n) +__builtin_popcountll(x) % 2);
	}
}

Compilation message (stderr)

cats.cpp: In function 'int main()':
cats.cpp:7:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    7 |  scanf("%d",&q);
      |  ~~~~~^~~~~~~~~
cats.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |   scanf("%lld %lld %lld",&x,&l,&n);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...