problem description
this is kolakosiki sequence: 1
,2,2
,1,1
,2,1
,2,2
,1,2
,2,1
,1,2
,1,1
,2,2
,1……
. this sequence consists of 1
and 2
, and its first term equals 1
. besides, if you see adjacent and equal terms as one group, you will get 1
,22,11
,2,1
,22,1
,22,11
,2,11
,22,1
……. count number of terms in every group, you will get the sequence itself. now, the sequence can be uniquely determined. please tell hazelfan its n
th element.
input
the first line contains a positive integer t
(1≤t
≤5) , denoting the number of test cases.
for each test case:
a single line contains a positive integer n
(1≤n
≤107)
.output
for each test case:
a single line contains a nonnegative integer, denoting the answer.
sample input
212
sample output
12
題意即為 每連續的相同數字即為一組,ai表示第i組有ai個數。例如a3為2,表明第三組有兩個數,即a4=a5=1(因為第二組的數為2,要與上一組的數不同)。因為a4為1,第四組就為乙個數,即a6=2.
#includeusing namespace std;
// 1,2,2,1,1,2,1,2,2,1,2,2,1,1,2,1,1,2,2,1,2,1,1,2,1,2,2,1,1 kolakoski數列
int a[10000000]= ;
int main() else
}cin>>t;
while(t--) {
int n;
cin>>n;
cout<
MASA Blazor多頁籤元件
找了一圈的blazor多頁籤元件,感覺都太麻煩,於是開發了這個。demo 原始碼 用法只要在mainlayout.razor的 body外面套個pagetabs元件就可以了,items是要快取的頁面配置。items body code 高階用法 可以使用tabcontent插槽,自定義樣式。item...
如何收集 multisig (多簽)簽名
在製作多簽提案時,您必須指定簽名者。使用標誌 request,然後列出您需要收集簽名的帳戶,以逗號分隔。除非您通過新增 permission name另行指定,否則它將請求active許可權。中新增了一些 flag 來自動化部分過程。讓我們逐一介紹它們,並舉例說明什麼時候可以使用它們。eosio.p...
多校4 櫥櫃
include include include include includeusing namespace std int s1 400100 int s2 400100 struct node struct cmp int main int i,j,m,n while scanf d d n,m...