2017CCPC哈爾濱 F:Permutation(構造)
題意:
讓你構造一個1到n的全排列,滿足對於所有的i>=3,都有a[i]%|a[i]-a[i-2]|==0
思路:假設n=10
構造出的序列就是:1 6 2 7 3 8 4 9 5 10
OK
//2017CCPC哈爾濱--F #include<stdio.h> int a[100005]; int main(void) { int T, n, i, now; scanf("%d", &T); while(T--) { scanf("%d", &n); now = 0; for(i=1;i<=n;i+=2) a[i] = ++now; for(i=2;i<=n;i+=2) a[i] = ++now; printf("%d", a[1]); for(i=2;i<=n;i++) printf(" %d", a[i]); printf("\n"); } return 0; }
相關推薦
2017CCPC哈爾濱 F:Permutation(構造)
題意: 讓你構造一個1到n的全排列,滿足對於所有的i>=3,都有a[i]%|a[i]-a[i-2]|==0 思路:假設n=10 構造出的序列就是:1 6 2 7 3 8 4 9 5 10
Python:What the f*ck Python(上)
GitHub 上有一個名為《What the f*ck Python!》的專案,這個有趣的專案意在收集 Python 中那些難以理解和反人類直覺的例子以及鮮為人知的功能特性,並嘗試討論這些現象背後真正的原理! 原版地址:https://github.com/satwikkansal/wtfpython
Python:What the f*ck Python(下)
GitHub 上有一個名為《What the f*ck Python!》的專案,這個有趣的專案意在收集 Python 中那些難以理解和反人類直覺的例子以及鮮為人知的功能特性,並嘗試討論這些現象背後真正的原理! 原版地址:https://github.com/satwikkansal/wtfpython
R:ggplot2(8),第4章 ggplot2構造影象的基本思想及總結練習(4)
講一下各個小節都主要寫了哪些內容,然後總結一下基本的思想原理。 根據stat_XXX或geom_XXX的方法繪製幾個有代表的圖形,前面寫過的也可以照搬過來,書上的那幾個圖也嘗試著畫一下,另外,4.5.3
“玲瓏杯”ACM比賽 Round #4 F -- My-graph【圖的同構(構造)】
Start Time:2016-11-05 12:00:00 End Time:2016-11-05 17:00:00 Refresh Time:2016-11-06 22:00:19 P
機器學習:準確率(Precision)、召回率(Recall)、F值(F-Measure)、ROC曲線、PR曲線
介紹: 準確率(Precision)、召回率(Recall)、F值(F-Measure)是資料探勘、機器學習 和推薦系統中的評測指標。 下圖是不同機器學習演算法的評價指標: 本文的物件是二元分類器! 在 介紹評價指標必須瞭解“混淆矩陣” 混淆矩陣 True Posi
F# 之旅(上)
簡單 ssi arp compile posit slist change 縮進 類型 寫在前面的話 解答一下在上一篇文章《在Visual Studio中入門F#》中有人的提問, 1. 問:是準備寫 F# 系列嗎? 答:當然不是,本人也是剛剛學習 F#,只是
不談OI:高二(13)最後一次班班有歌聲
決賽 .com get 視頻 真的 html 沒有 .html 歌聲 最後一次班班有歌聲了…… 自己因為搞oi並沒有參加,只是決賽的時候幕後放了放背景視頻…… 不管怎麽說,我們班唱的很棒啊,全部人都很棒! 說真的我為我們班驕傲 視頻: https://v.qq.com/x/
LIVE555研究之五:RTPServer(二)
tpch live555 循環調用 family 每一個 函數 計算 ack close LIVE555研究之五:RTPServer(二) 接上文,main函數的幾行代碼創建了RTSPSe
hdu5301(2015多校2)--Buildings(構造)
das pos floor eof text new tom fcm 20px Buildings Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/
深入淺出CSS:Div(一)
指定 增加 src 深入 lock alt 舉例 gin width 這個系列是學習筆記,簡明記錄結論性的知識。 新建一個層時,border為零,margin為0,padding為0,如果不指定寬度(width),則自動100%填充父元素。 三、層與父元素的關系 1.
Linux查看文件內容命令:less(轉)
get 忽略 編輯器 blank 命令 spa bsp 打開 保存 less與more類似,但使用less可以隨意瀏覽文件,而more僅能向前移動,卻不能向後移動,而且less在查看之前不會加載整個文件。 語法 less [參數] 文件 參數說明: -b
HTTP請求和響應2:方法(Method)
trace 行處理 診斷 ack 中間 delete nds 最優 eas 方法表明了client希望server對資源運行的動作。經常使用的方法包含:GET、HEAD、POST、PUT、TRACE、OPTIONS和DELETE,每一個server能夠實現這些方法中
GYM 101173 K.Key Knocking(構造)
tdi 要求 using fine time .net ios ble sin 原題鏈接 參考自 問題描述:一個長度為3*n的01串,每次可以翻轉連續的兩個字符,要求至多翻轉n次使得這個3*n的串至少有2*n個連續的段且相鄰兩端不一樣(就是連續的0算一段,然
C語言中存儲類別又分為四類:自動(auto)、靜態(static)、寄存器的(register)和外部的(extern)。
字符變量 修飾 例如 register ext 進行 適合 sta -- 除法運算中註意: 如果相除的兩個數都是整數的話,則結果也為整數,小數部分省略,如8/3 = 2;而兩數中有一個為小數,結果則為小數,如:9.0/2 = 4.500000。 取余運算中註意: 該運算只適
深入理解Java:註解(Annotation)--註解處理器
fault this urn 復制代碼 lena ide set java lec 深入理解Java:註解(Annotation)--註解處理器 如果沒有用來讀取註解的方法和工作,那麽註解也就不會比註釋更有用處了。使用註解的過程中,很重要的一部分就是創建於
java:LeakFilling(Hibernate)
href ssi update bject face hbm 管理 top 數據 1.關系型數據庫: Oracle / Mysql 數據持久化的技術: IO JDBC XML ... 主流的持久層框架: Hibernate mybatis---
java:Maven(Maven_ssm)
one eap oot model size lib bug not txadvice 1.maven_ssm: pom.xml: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xs
我的項目經驗總結——CDN鏡像:1(初探)
基礎上 image 高訪問 str 如果 ron 意思 dns 但是 前言 其實,這個標題有些大,作為一個小白,只是在實際工作中經常聽聞我司的CDN服務如何如何牛B……而且我司的雲服務還拿到了工信部的CDN牌照……那
ggplot2作圖詳解7(完):主題(theme)設置
clas base 參數 由於 end 文字標簽 cut evaluate minor 凡是和數據無關的圖形設置內容理論上都可以歸為主題類,但考慮到一些內容(如坐標軸)的特殊性,可以允許例外的情況。主題的設置相當繁瑣,很容易就占用了 大量的作圖時間,應盡量把這些東西簡化,把