Codeforces 371BB. Fox Dividing Cheese】的更多相关文章

Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The bears are so greedy that they are ready to fight for the larger piece. That's where the fox comes in and starts the dialog: "Little be…
题目链接 Fox Dividing Cheese 思路:求出两个数a和b的最大公约数g,然后求出a/g,b/g,分别记为c和d. 然后考虑c和d,若c或d中存在不为2,3,5的质因子,则直接输出-1(根据题目要求) 计算出c = (2 ^ a2) * (3 ^ a3) * (5 ^ a5)      d = (2 ^ b2) * (3 ^ b3) * (5 ^ b5) 那么答案就是a2 + a3 + a5 + b2 + b3 + b5 #include <bits/stdc++.h> usin…
#include<stdio.h> int count; int gcd(int a,int b) { if(b==0) return a;     return gcd(b,a%b); } int seach(int a) { if(a%2==0) { count++; return seach(a/2); } if(a%3==0) { count++; return seach(a/3); } if(a%5==0) { count++; return seach(a/5); } retur…
B. Fox Dividing Cheese time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The be…
B. Fox Dividing Cheese time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Two little greedy bears have found two pieces of cheese in the forest of weight a and b grams, correspondingly. The be…
http://codeforces.com/contest/371/problem/B #include <cstdio> #include <iostream> #include <cstring> #include <algorithm> #define ll int using namespace std; ll a,b; ; int m1,m2; int check(ll x) { while(x) { ==) x/=; ==) x/=; ==) x…
A. Fox and Box Accumulation time limit per test:1 second memory limit per test:256 megabytes Fox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its t…
Codeforces Round #228 (Div. 1) 题目链接:C. Fox and Card Game Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card. The players take turns and Ciel takes the first…
题目链接:http://codeforces.com/problemset/problem/510/B 题目意思:给出 n 行 m 列只有大写字母组成的字符串.问具有相同字母的能否组成一个环. 很容易知道要用到深搜.暴力搜索--- #include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; + ; char g[maxn][m…
388A - Fox and Box Accumulation 思路: 从小到大贪心模拟. 代码: #include<bits/stdc++.h> using namespace std; const int INF=0x3f3f3f3f; ; int a[N]; bool vis[N]={false}; int main() { ios::sync_with_stdio(false); cin.tie(); int n; ; cin>>n; ;i<n;i++) { cin&…