Submission #45675382


Source Code Expand

#include <bits/stdc++.h>

using namespace std;

int main() {
    int t;
    cin >> t;
    while(t--){
        long long n;
        cin >> n;
        bool fl = 0;
        // auto lcm = [](long long a, long long b) -> int{
        //     return a * b / __gcd(a, b);
        // };
        bool ok = false;
        for(long long i = 1; i * i <= n; i++){
            if(n % i == 0){
                if(i + n/i <= n && __gcd(i, n/i) == 1){
                    ok = true;
                    break;
                }
            }
        }
        if(!ok)
        cout << "No\n";
        else cout << "Yes\n";
    }
}

Submission Info

Submission Time
Task A - Sum equals LCM
User karandeep09
Language C++ 20 (gcc 12.2)
Score 400
Code Size 638 Byte
Status AC
Exec Time 4 ms
Memory 3572 KiB

Compile Error

Main.cpp: In function ‘int main()’:
Main.cpp:11:14: warning: unused variable ‘fl’ [-Wunused-variable]
   11 |         bool fl = 0;
      |              ^~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 1
AC × 16
Set Name Test Cases
Sample 00_sample_01.txt
All 00_sample_01.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 02_large_01.txt, 02_large_02.txt, 02_large_03.txt, 02_large_04.txt, 02_large_05.txt, 03_rand_01.txt, 03_rand_02.txt, 03_rand_03.txt, 04_test_01.txt, 04_test_02.txt, 04_test_03.txt, 04_test_04.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 1 ms 3448 KiB
01_small_01.txt AC 1 ms 3436 KiB
01_small_02.txt AC 1 ms 3560 KiB
01_small_03.txt AC 1 ms 3468 KiB
02_large_01.txt AC 4 ms 3464 KiB
02_large_02.txt AC 4 ms 3572 KiB
02_large_03.txt AC 4 ms 3444 KiB
02_large_04.txt AC 4 ms 3496 KiB
02_large_05.txt AC 4 ms 3508 KiB
03_rand_01.txt AC 1 ms 3468 KiB
03_rand_02.txt AC 1 ms 3492 KiB
03_rand_03.txt AC 1 ms 3456 KiB
04_test_01.txt AC 3 ms 3496 KiB
04_test_02.txt AC 3 ms 3492 KiB
04_test_03.txt AC 3 ms 3460 KiB
04_test_04.txt AC 2 ms 3496 KiB