Submission #3776309


Source Code Expand

#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main(void){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int k, s;
    cin >> k >> s;
    int cnt = 0, x, y, z;
    for (x = 0; x <= k;x++){
        for (y = 0; y <= k;y++){
            z = s - x - y;
            if(0<=z&&z<=k)
                cnt++;
        }
    }
    cout << cnt << endl;
    return 0;
}

Submission Info

Submission Time
Task B - Sum of Three Integers
User rumoisen
Language C++14 (GCC 5.4.1)
Score 200
Code Size 866 Byte
Status AC
Exec Time 7 ms
Memory 256 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All sample_01.txt, sample_02.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt
Case Name Status Exec Time Memory
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
subtask_1_01.txt AC 7 ms 256 KB
subtask_1_02.txt AC 2 ms 256 KB
subtask_1_03.txt AC 5 ms 256 KB
subtask_1_04.txt AC 2 ms 256 KB
subtask_1_05.txt AC 1 ms 256 KB
subtask_1_06.txt AC 2 ms 256 KB
subtask_1_07.txt AC 5 ms 256 KB
subtask_1_08.txt AC 1 ms 256 KB