题解 | 四季

四季

https://www.nowcoder.com/practice/eaf21203b61b4a689987fdc165d00dfc

#include <iostream>
using namespace std;

int main (){
    int YM = 0 ;
    cin >> YM ;
    int e = YM % 10;
    int s = YM % 100 / 10;
    int season = 10*s + e ;
    if (season <= 5){
        if ( season >= 3 ){
            cout << "spring" << endl;
        }
        else {
            cout << "winter" << endl;
        }
    }
    else {
        if ( season <= 8 ){
            cout << "summer" <<endl;
        }
        else {
            if ( season != 12 ){
                cout << "autumn" << endl;
            }
            else {
                cout << "winter" << endl;
            }
        }
    }
    return 0 ;
}

全部评论

相关推荐

程序员花海:最好不要在简历写电商 电商覆盖域太多了 订单 购物车 交易 招商 营销 氛围 履约 售后 用户增长 营销等等一系列都是电商,你写一个这么大的项目是让面试官随便挑一个擅长的来问吗?
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务