Submission #43418008


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int t;
long long n, k;

int main() {
	scanf("%d", &t);
	while (t--) {
		scanf("%lld%lld", &n, &k);
		if (k > n) {
			puts("No");
			continue;
		}
		while (n) {
			k -= n % 3;
			n /= 3;
		}
		puts(k >= 0 && k % 2 == 0 ? "Yes" : "No");
	}
}

Submission Info

Submission Time
Task A - Ternary Decomposition
User nhho
Language C++ (GCC 9.2.1)
Score 300
Code Size 310 Byte
Status AC
Exec Time 52 ms
Memory 3664 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:9:7: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
    9 |  scanf("%d", &t);
      |  ~~~~~^~~~~~~~~~
./Main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   11 |   scanf("%lld%lld", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 7
Set Name Test Cases
Sample sample-01.txt
All in-01.txt, in-02.txt, in-03.txt, in-04.txt, in-05.txt, in-06.txt, sample-01.txt
Case Name Status Exec Time Memory
in-01.txt AC 31 ms 3480 KiB
in-02.txt AC 52 ms 3472 KiB
in-03.txt AC 41 ms 3632 KiB
in-04.txt AC 43 ms 3608 KiB
in-05.txt AC 35 ms 3664 KiB
in-06.txt AC 31 ms 3604 KiB
sample-01.txt AC 7 ms 3612 KiB