CF1206C Almost Equal


思路


看样例的话,是不是可能偶数没用了??

然后考虑奇数的话,照着样例模拟模拟试试??

反正我打的vp,,不会掉分哒!

随便打了个代码结果AC了233


#include <bits/stdc++.h>
#define maxn 200010
using namespace std ;
int n , a[maxn] ;
int main () {
   cin >> n ;
   if(n %2 == 0) {
   	cout << "NO\n" ;
   	return 0 ;
   }else {
   	puts("YES") ;
   	int tot = 0 ,lop = 1 ;
   	while(++tot != n+n+1) {
//			cout << lop << " *" ;
   		a[lop] = tot ;
   		if(tot%2 == 1) {
   			if(lop <= n) {
   				lop += n ;
   			}else {
   				lop -= n ;
   			}
   		}else {
   			lop += 1 ;
   		}
   	}
   	for(int i = 1 ; i <= n+n;i ++) {
   		cout << a[i] << " " ;
   	}
   }
   return 0 ;
}

溜了溜了

posted @ 2019-08-22 11:41  _L_Y_T  阅读(141)  评论(0编辑  收藏  举报