Polycarp likes to play with numbers. He takes some integer number xx, writes it down on the board, and then performs with it n−1n−1 operations of the two kinds: divide the number xx by 33 (xx must be divisible by 33); multiply the number xx by 22. Af…
传送门 D. Divide by three, multiply by two •题意 给你一个数 x,有以下两种操作,x 可以任选其中一种操作得到数 y 1.如果x可以被3整除,y=x/3 2.y=x*2 y 再执行上述两种操作的一种得到数 z: 接着对 z 得到...... 这样依次执行了 n-1 次会得到 n 个数: 现在给你这 n 个数,让你按照上述规则给这 n 个数排序,使得其满足 a1=x , a2=y , a3=z , ........ •思路 对于任意一个数 p,能通过两类操作得…
D. Divide by three, multiply by two time limit per test 1 second memory limit per test 256 megabytes input:standard input output:standard output Polycarp likes to play with numbers. He takes some integer number x, writes it down on the board, and the…
  Polycarp likes to play with numbers. He takes some integer number xx, writes it down on the board, and then performs with it n−1n−1operations of the two kinds: divide the number xx by 33 (xx must be divisible by 33); multiply the number xx by 22. A…
题意 有nnn个无序的数,对这些数进行排列,要求ai=3×ai+1a_i=3\times a_{i+1}ai​=3×ai+1​或2×ai=ai+12\times a_i=a_{i+1}2×ai​=ai+1​,保证这些数有解,输出排序后的数 AC代码 /************************************************************************* > File Name: DD.cpp > Author: WZY > QQ: 269709…
题意:给你一个长度为\(n\)的序列\(a\).对它重新排列,使得\(a_{i+1}=a_{i}/3\)或\(a_{i+1}=2*a_{i}\).输出重新排列后的序列. 题解:经典DFS,遍历这个序列,对每个数dfs,每次dfs使\(len+1\),当\(len=n\)时,说明这个序列已经满足条件了,输出并且标记一下,防止还有另外的情况导致多输出. 代码: #include <iostream> #include <cstdio> #include <cstring>…
Polycarp likes to play with numbers. He takes some integer number x, writes it down on the board, and then performs with it n−1 operations of the two kinds: 1.divide the number x by 3 (x must be divisible by 3);    2.multiply the number x by 2. After…
传送门:点我 题意:给定n长度的序列,重排成后一个数是前一个数除以三,或者后一个数是前一个数乘二,要求输出这个序列. 思路:大力深搜,对每个数搜除3的和乘2的是否出现过,然后继续搜下去.如果有一个数搜能搜完整个序列,那就输出这个数开始的一整个序列. 代码: #include<bits/stdc++.h> using namespace std; typedef unsigned long long LL; ,flag = ; int n,k; map<LL,int>ma; LL b…
题目链接 我同学在旁边做者道题,我也看了一下 真的好水难 一看这道题,直接搜索 剪枝是不可能剪枝的一辈子不可能 Code #include <cstdio> #include <iostream> #include <algorithm> using namespace std; const long long MAXN = 105; long long n; long long a[MAXN],b[MAXN]; bool sign = false; bool flag…
Squats Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Pasha has many hamsters and he makes them work out. Today, n hamsters (n is even) came to work out. The hamsters lined up and each hamster e…