Submission #1637159


Source Code Expand

Copy
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
//---------------------------------------------------------------------------------------------------


typedef long long ll;
ll N;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;

    rep(h, 1, 3501) rep(n, 1, 3501) {
        // 4/N = 1/h + 1/n + 1/w
        
        ll up = N * h * n;
        ll dow = 4LL * h * n - N * n - N * h;
        if (dow == 0) continue;
        if (up % dow != 0) continue;
        ll w = up / dow;
        if (0 < w && w <= 3500) {
            printf("%d %d %lld\n", h, n, w);
            return;
        }
    }
}

Submission Info

Submission Time
Task C - 4/N
User hamayanhamayan
Language C++14 (GCC 5.4.1)
Score 300
Code Size 923 Byte
Status AC
Exec Time 128 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 50
Set Name Test Cases
Sample 0002, 3485, 4664
All 0002, 0003, 0004, 0005, 0006, 0007, 0049, 0073, 0097, 0121, 0137, 0139, 0156, 0163, 0169, 0181, 0191, 0223, 0229, 0263, 0271, 0289, 0361, 0481, 0529, 0551, 0649, 0720, 0916, 1081, 1156, 1498, 1921, 2041, 2329, 2449, 2568, 2918, 2929, 3289, 3429, 3485, 3763, 4081, 4277, 4648, 4652, 4656, 4660, 4664
Case Name Status Exec Time Memory
0002 AC 1 ms 256 KB
0003 AC 1 ms 256 KB
0004 AC 1 ms 256 KB
0005 AC 1 ms 256 KB
0006 AC 1 ms 256 KB
0007 AC 1 ms 256 KB
0049 AC 2 ms 256 KB
0073 AC 2 ms 256 KB
0097 AC 2 ms 256 KB
0121 AC 2 ms 256 KB
0137 AC 2 ms 256 KB
0139 AC 2 ms 256 KB
0156 AC 3 ms 256 KB
0163 AC 3 ms 256 KB
0169 AC 3 ms 256 KB
0181 AC 3 ms 256 KB
0191 AC 3 ms 256 KB
0223 AC 3 ms 256 KB
0229 AC 3 ms 256 KB
0263 AC 4 ms 256 KB
0271 AC 4 ms 256 KB
0289 AC 4 ms 256 KB
0361 AC 5 ms 256 KB
0481 AC 6 ms 256 KB
0529 AC 6 ms 256 KB
0551 AC 7 ms 256 KB
0649 AC 8 ms 256 KB
0720 AC 8 ms 256 KB
0916 AC 18 ms 256 KB
1081 AC 18 ms 256 KB
1156 AC 16 ms 256 KB
1498 AC 21 ms 256 KB
1921 AC 38 ms 256 KB
2041 AC 43 ms 256 KB
2329 AC 56 ms 256 KB
2449 AC 41 ms 256 KB
2568 AC 40 ms 256 KB
2918 AC 54 ms 256 KB
2929 AC 53 ms 256 KB
3289 AC 64 ms 256 KB
3429 AC 84 ms 256 KB
3485 AC 79 ms 256 KB
3763 AC 81 ms 256 KB
4081 AC 96 ms 256 KB
4277 AC 112 ms 256 KB
4648 AC 128 ms 256 KB
4652 AC 128 ms 256 KB
4656 AC 128 ms 256 KB
4660 AC 128 ms 256 KB
4664 AC 128 ms 256 KB