ZOJ 3798Abs Problem

xiaoxiao2021-02-28  30

http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3798

水题

#include<iostream> using namespace std; int res[50050]; int main() { int n; while(cin>>n) { int cmp=n%4; int cmpp=(n-1)%4; if(cmp==1||cmp==2) { cout<<"1 "; } else cout<<"0 "; if(cmpp==1||cmpp==2) { cout<<n-1<<endl; } else cout<<n<<endl; int p=0; for(int i=n;i>0;i--) { if(p++) cout<<" "; cout<<i; } cout<<endl; for(int i=n-1;i>0;i--) { cout<<i<<" "; } cout<<n<<endl; } return 0; }

转载请注明原文地址: https://www.6miu.com/read-2800165.html

最新回复(0)