給兩個數 m, d
計算 s = (m*2+d)%3
依照 s 的值從 0~2 分別輸出 “普通”、“吉”、“大吉”
評分結果(參考) : AC (2ms, 344KB)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b, s;
cin >> a >> b;
s = (a*2+b)%3;
vector<string> v = {"普通", "吉", "大吉"};
cout << v[s];
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int a, b, s;
cin >> a >> b;
s = (a*2+b)%3;
switch(s){
case 0: cout << "普通"; break;
case 1: cout << "吉"; break;
case 2: cout << "大吉"; break;
}
return 0;
}