CodeFoeces-750B

题目

原题链接:B. New Year and North Pole

题意

若在北极,则必须往南极移动,反之往北极移动,终点必须为北极,起点为北极。
参考了其他作者的代码,若在北极时不往南极移动或在南极不往北极移动,不满足条件。

代码

#include
using namespace std;
int main() {
    int n,l,flag=1,sum=0;
    char d[6];
    scanf("%d",&n);
    for(int i=0; i20000){//满足这个条件代表已在某极且向该极移动 
            flag=0;
        }
    }
    if(!flag || sum!=0) printf("NO\n");
    else printf("YES\n");
    return 0;
}

你可能感兴趣的:(CodeFoeces-750B)