Official
A - chmin Editorial by en_translator
For beginners
- 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.
- Also, if you are not familiar with problems in programming contests, we recommend you to try some problems in "AtCoder Beginners Selection".
- 「C++入門 AtCoder Programming Guide for beginners (APG4b)」 is a C++ tutorial for competitive programmers. Sadly, this is only in Japanese too.
- 「Python入門 AtCoder Programming Guide for beginners (APG4bPython)」 is a Python tutorial for competitive programmers. Again, this is only in Japanese.
To fulfill the problem statement’s requirement, we need to do the following:
- Process \(i=1,2,\dots,N\) in order.
- Make a comparison to determine if \(A_i < X\).
The former can be done with a for loop, and the latter can be done with an if loop.
Sample code (C++):
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,x;
cin >> n >> x;
for(int i=1;i<=n;i++){
int a;
cin >> a;
if(a<x){
x=a;
cout << "1\n";
}
else{
cout << "0\n";
}
}
return 0;
}
posted:
last update: