1370A - Maximum GCD - CodeForces Solution


greedy implementation math number theory *800

Please click on ads to support us..

Python Code:

for i in range(int(input())):
    n = int(input())
    print(n//2)

C++ Code:

#include <iostream>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <cassert>
#include <string>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <sstream>
#include <numeric>
#include <climits>

using namespace std;

int main(int argc, char **argv) {
    int T;
    scanf("%d", &T);
    while (T-- != 0) {
        int n;
        scanf("%d", &n);
        printf("%d\n", n >> 1);
    }
    return 0;
}


Comments

Submit
0 Comments
More Questions

53A - Autocomplete
1729G - Cut Substrings
805B - 3-palindrome
805C - Find Amir
676C - Vasya and String
1042B - Vitamins
1729F - Kirei and the Linear Function
25D - Roads not only in Berland
1694A - Creep
659F - Polycarp and Hay
1040A - Palindrome Dance
372A - Counting Kangaroos is Fun
1396B - Stoned Game
16A - Flag
1056A - Determine Line
670B - Game of Robots
1418C - Mortal Kombat Tower
1382B - Sequential Nim
1272C - Yet Another Broken Keyboard
808A - Lucky Year
1245A - Good ol' Numbers Coloring
58B - Coins
1041C - Coffee Break
507A - Amr and Music
1041D - Glider
1486A - Shifting Stacks
1389B - Array Walk
71B - Progress Bar
701A - Cards
545A - Toy Cars