Run ID:101819

提交时间:2024-12-19 13:12:00

/* 现在有一个新序列: 10000 10000 9999 9998 9998 9996 9997 9994 9996 9992 9995 9990 … … 10000 9999 9998 9997 9996 9995 1 3 5 7 9 11 10000 9998 9996 9994 9992 9990 2 4 6 8 10 12 现在期望你能够根据给出的前几项推导出对应的规律,输出第n项的值。 */ #include <iostream> using namespace std; int main(){ int n; cin>>n; if(n%2==0) { n = n/2; int start=10000; for(int i=1;i<n;i++) start = start -2; cout<<start; } else{ n = n/2 +1 ; int start=10000; for(int i=1;i<n;i++) start = start -1; cout<<start; } }