EX10
#include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
cin >> A >> B;
cout<<"A:";
for(int i=0; i<A; i++){
cout<< "]";
}
cout<<endl;
cout<<"B:";
for(int i=0; i<B; i++){
cout<< "]";
}
cout<<endl;
}
EX9
#include <bits/stdc++.h>
using namespace std;
int main() {
int x, a, b;
cin >> x >> a >> b;
int c,d,e;
// 1.の出力
x++;
cout << x << endl;
//2
c = x *(a+b);
cout << c << endl;
//3
d=c*c;
cout << d << endl;
//4
e=d-1;
cout << e << endl;
// ここにプログラムを追記
}
EX8
#include <bits/stdc++.h>
using namespace std;
int main() {
int p;
cin >> p;
string text;
int price;
// パターン1
if (p == 1) {
cin >> price;
}
// パターン2
if (p == 2) {
cin >> text >> price;
}
int N;
cin >> N;
if(p==2){
cout << text << "!" << endl;}
cout << price * N << endl;
}
EX7
#include <bits/stdc++.h>
using namespace std;
int main() {
// 変数a,b,cにtrueまたはfalseを代入してAtCoderと出力されるようにする。
bool a = true; // true または false
bool b = false;// true または false
bool c = true;// true または false
// ここから先は変更しないこと
if (a) {
cout << "At";
}
else {
cout << "Yo";
}
if (!a && b) {
cout << "Bo";
}
else if (!b || c) {
cout << "Co";
}
if (a && b && c) {
cout << "foo!";
}
else if (true && false) {
cout << "yeah!";
}
else if (!a || c) {
cout << "der";
}
cout << endl;
}
EX6
#include <bits/stdc++.h>
using namespace std;
int main() {
int A, B;
string op;
cin >> A >> op >> B;
if (op == "+") {
cout << A + B << endl;
}
else if (op == "-") {
cout << A - B << endl;
}
else if (op == "*") {
cout << A * B << endl;
}
else if (op == "/") {
if(B==0){cout << "error"<<endl;}
else
{
cout << A / B << endl;
}
}else{cout << "error"<<endl;}
return 0;
// ここにプログラムを追記
}
EX5
#include <bits/stdc++.h>
using namespace std;
int main() {
int A,B;
cin >> A >>B;
cout << A+B<<endl;
}
EX4
#include <bits/stdc++.h>
using namespace std;
int main() {
// 一年の秒数
int seconds = 365 * 24 * 60 * 60;
// 以下のコメント/* */を消して追記する
cout << seconds *1/* 1年は何秒か */ << endl;
cout << seconds *2/* 2年は何秒か */ << endl;
cout << seconds *5/* 5年は何秒か */ << endl;
cout << seconds *10/* 10年は何秒か */ << endl;
}
EX3
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << (100+1)*100/2 << endl;
}
EX2
#include <bits/stdc++.h>
using namespace std;
int main() {
cout << "いつも" << 2525 << endl;
cout << "AtCoderくん" << endl;
}
EX1
#include<bits/stdc++.h>
using namespace std;
int main(){
cout << "こんにちは\nAtCoder\n";
return 0;
} // namespace sdt;