A - Divide it! CodeForces - 1176A】的更多相关文章

题目: You are given an integer nn. You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace nn with n2n2 if nn is divisible by 22; Replace nn with 2n32n3 if nn is divisible by 33; Replace n…
题目链接:http://codeforces.com/problemset/problem/1176/A 思路:贪心,对第二个操作进行俩次等于将n变成n/3,第三个操作同理,我们将n不断除以2,再除以3,最后除以5,判断最后是否等于1即可. AC代码: #include<iostream> using namespace std; long long n,ans; int main(){ int T; cin >> T; while(T--){ cin >> n; an…
You are given an integer nn. You can perform any of the following operations with this number an arbitrary (possibly, zero) number of times: Replace nn with n2n2 if nn is divisible by 22; Replace nn with 2n32n3 if nn is divisible by 33; Replace nn wi…
Arkady and his friends love playing checkers on an n×nn×n field. The rows and the columns of the field are enumerated from 11 to nn. The friends have recently won a championship, so Arkady wants to please them with some candies. Remembering an old pa…
题目链接:codeforces 792C. Divide by Three 今天队友翻了个大神的代码来问,我又想了遍这题,感觉很好,这代码除了有点长,思路还是清晰易懂,我就加点注释存一下...分类吧.删除一个数字模3为M的或删除两个模3为3-M的(还有一些要删零),具体看代码. #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<strin…
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…
https://codeforces.com/contest/1056/problem/B 题意:输入n,m    求((a*a)+(b*b))%m==0的(a,b)种数(1<=a,b<=n) (n<=1e9,m<=1000) 题解:由于a,b的数量级很大,而m的数量级很小,又因为求((a*a)+(b*b))%m==0,即求((a%m*a%m)+(b%m*b%m))%m==0满足要求的a,b对数,也就是求a%m,b%m的平方分别取模后相加为0或者m的a,b对数,由于此时问题只和a%…
地址:http://codeforces.com/contest/768/problem/D 题目: D. Jon and Orbs time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jon Snow is on the lookout for some orbs required to defeat the white wal…
地址:http://codeforces.com/contest/768/problem/C 题目: C. Jon Snow and his Favourite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Jon Snow now has to fight with White Walkers. He has…
地址:http://codeforces.com/contest/768/problem/B 题目: B. Code For 1 time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jon fought bravely to rescue the wildlings who were attacked by the white-w…