Official
A - Div Editorial by en_translator
If you are new to learning programming and do not know where to start, please try Problem A “Welcome to AtCoder” from practice contest. There you can find a sample code for each language.
In this problem, the sweets are indistinguishable, so we only have to consider how many sweets A and B receive. There are \(N-1\) possible numbers of sweets that A may receive, spanning from \(1\) through \(N-1\) (inclusive). This holds even if \(N=1\). Therefore, you can receive an integer from the standard input, and then output the value subtracted by one.
Sample Code (Python)
N = int(input())
print(N-1)
Sample Code (C++)
#include <iostream>
using namespace std;
int main(){
int N;
cin >> N;
cout << N-1;
}
Sample Code (C)
#include<stdio.h>
int main(){
int N;
scanf("%d", &N);
printf("%d", N-1);
}
posted:
last update: