季风
icebear233
·
·
题解
P 题解
时间复杂度 O(1) (显然)
大致题意:给出 a , b 分别表示南北和东西的风速,依据 a , b 的值判断此时风向。
思路:可以看到,答案是先输出南北再输出东西,所以我们可以分开写,例如若 a 值大于 0 就先输出 North , b 值大于
写法: if 语句直接判断,详细看代码吧。
```cpp
#include<bits/stdc++.h>
using namespace std;
int a,b;
string s;
int main(){
cin>>a>>b;//如题
if(a>0)cout<<"North";
if(a<0)cout<<"South";
if(b>0)cout<<"East";
if(b<0)cout<<"West";
return 0;//好习惯
}//挑战最短代码
```