CSES - COCI 2007/2008 #2 - Results
Submission details
Task:Crne
Sender:henrikaalto
Submission time:2019-07-29 16:25:02 +0300
Language:C++ (C++17)
Status:READY
Result:100
Feedback
groupverdictscore
#1ACCEPTED100
Test results
testverdicttime
#1ACCEPTED0.01 sdetails
#2ACCEPTED0.01 sdetails
#3ACCEPTED0.01 sdetails
#4ACCEPTED0.01 sdetails
#5ACCEPTED0.01 sdetails

Code

#include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(), x.end()
using ii=long long;
int main()
{
    int n;
    cin >> n;
    
    
    // 2, 4, 6, 9, 12, 16, 21, 
    //2*1 2*2    3*3 4*3 4*4 5*4 5*5
    
    
    int r = 0;
    for (int x = 0; x <= 100; ++x){
        for (int y = 0; y <= 100; ++y) {
            if (y + x - 2 == n) {
                r = max(r, y * x);
            }
        }
    }
    cout << r << "\n";
    
}

Test details

Test 1

Verdict: ACCEPTED

input
2

correct output
4

user output
4

Test 2

Verdict: ACCEPTED

input
5

correct output
12

user output
12

Test 3

Verdict: ACCEPTED

input
10

correct output
36

user output
36

Test 4

Verdict: ACCEPTED

input
59

correct output
930

user output
930

Test 5

Verdict: ACCEPTED

input
100

correct output
2601

user output
2601