Official
A - You should output ARC, though this is ABC. Editorial by physics0523
この問題を for 文を使わずに if 文を利用した条件分岐のみで解くこともできますが、今回はあえて for 文を用いた実装を示しましょう。
競技プログラミングにおいて、2次元配列はパラメータとして標準入力から与えられることが多いですが、今回の問題の場合は例えば標準入力から以下の実装例のように受け取ればよいです。
そして、受け取った行列 \(A\) のうち \(A_{R,C}\) を出力してください。
実装例(C++):
#include<bits/stdc++.h>
using namespace std;
int main(){
int r,c;
cin >> r >> c;
int a[4][4];
for(int i=1;i<=2;i++){
for(int j=1;j<=2;j++){
cin >> a[i][j];
}
}
cout << a[r][c] << '\n';
return 0;
}
posted:
last update: