條件判斷

if else switch

if else

/*
 * zerojudge
 * a003. 兩光法師占卜術
 * C++
 * AC (3ms, 332KB)
*/
#include<bits/stdc++.h>
using namespace std;

int main(){
    int m,d;
    cin >> m >> d;
    //
    int s=(m*2+d)%3;
    //
    if(s==0){
        cout << "普通" << endl;
    }else if(s==1){
        cout << "吉" << endl;
    }else if(s==2){
        cout << "大吉" << endl;
    }
    //
    return 0;
}

Last updated

Was this helpful?