はじめに
たなしょです。
最近現場でreact.jsを使ってフロントエンドを作っています。
なかなかに楽しいですね。
問題文
考え方
文字列3つと数値2つ(a,b)を入力させます。
1文字列目と3文字列目が一致してたらaをデクリメント。
2文字列目と3文字列目が一致してたらbをデクリメント。
string str1, str2; cin >> str1 >> str2; int a, b; cin >> a >> b; string str3; cin >> str3; if (str1 == str3) { a--; }else { b--; }
いざ実装
#include <iostream> #include <vector> #include <utility> #include <algorithm> #include <cstdlib> #include <cmath> #include <iomanip> typedef long long ll; using namespace std; int main(void) { string str1, str2; cin >> str1 >> str2; int a, b; cin >> a >> b; string str3; cin >> str3; if (str1 == str3) { a--; }else { b--; } cout << a << ' ' << b << endl; return 0; }
最後に
material uiが便利ですね。
bootstrap感覚でデザインできるのは素晴らしいです。
最後まで読んでいただいてありがとうございました。 もしよろしければtwitterアカウント(@piklus100yen)もフォローしていただけると幸いです!