Codeforces #107 DIV2 ABCD
A
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
int n,k,l, c,d,p,nl,np;
int main()
{
while (cin >> n >> k >> l >> c >> d >> p >> nl >> np)
{
int a1 = k * l / nl;
int a2 = p / np;
int a3 = c * d;
cout << min(a1,min(a2,a3)) / n << endl;
}
return ;
}
B
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
struct node
{
int girl;
int pizza;
int taxi;
int s;
}src[];
char name[][];
int main()
{
// freopen("sample.txt","r",stdin);
int N;
while (scanf("%d",&N) != EOF)
{
for (int i = ; i < N ; i++)
{
scanf("%d%s",&src[i].s,name[i]);
src[i].girl = src[i].pizza = src[i].taxi = ;
for (int j = ; j < src[i].s; j++)
{
char tmp[];
scanf("%s",tmp);
bool flag =true;
int cnt[];memset(cnt,,sizeof(cnt));
cnt[tmp[] - ''] ++; cnt[tmp[] -''] ++;cnt[tmp[] -'']++;
cnt[tmp[] - ''] ++; cnt[tmp[] - ''] ++;cnt[tmp[] - '']++;
for (int j = ; j < ;j++) if (cnt[j] >= ) flag = false;
// printf("%d %d %d\n",a,b,c);
if (!flag) src[i].taxi++;
else if (tmp[] - '' > tmp[] - '' && tmp[] -'' > tmp[] - '' && tmp[] -'' > tmp[] - '' && tmp[] - '' > tmp[] -'' &&
tmp[] - '' > tmp[] - '') src[i].pizza++;
else src[i].girl++;
}
}
int anstaxi = -,st[],casst = ;
int anspizza = -,sp[],cassp = ;
int ansgirl = -,sg[],cassg = ;;
for (int i = ; i < N; i++)
{
if (anstaxi < src[i].taxi) {anstaxi = src[i].taxi; casst = ; st[casst++] = i;}
else if (anstaxi == src[i].taxi) {st[casst++]= i;}
if (anspizza < src[i].pizza) {anspizza = src[i].pizza ; cassp = ; sp[cassp++] = i;}
else if (anspizza == src[i].pizza) {sp[cassp++]= i;}
if (ansgirl < src[i].girl) {ansgirl = src[i].girl; cassg = ; sg[cassg++] = i;}
else if (ansgirl == src[i].girl) {sg[cassg++]= i;}
}
printf("If you want to call a taxi, you should call: ");
for (int i = ; i < casst ; i++)
{
if (i == casst - ) printf("%s.\n",name[st[i]]);
else printf("%s, ",name[st[i]]);
}
printf("If you want to order a pizza, you should call: ");
for (int i = ; i < cassp; i++)
{
if (i == cassp - ) printf("%s.\n",name[sp[i]]);
else printf("%s, ",name[sp[i]]);
}
printf("If you want to go to a cafe with a wonderful girl, you should call: ");
for (int i = ; i < cassg; i++)
{
if (i == cassg - ) printf("%s.\n",name[sg[i]]);
else printf("%s, ",name[sg[i]]);
}
}
return ;
}
C
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
vector <LL>G;
int main()
{
LL N;
while (cin >> N)
{
G.clear();
for (LL i = ; i * i <= N; i++)
while (N % i == )
{
G.push_back(i);
N /= i;
}
if (N > ) G.push_back(N);
if (G.size() < ) cout << << endl << <<endl;
else if (G.size() == ) cout << <<endl;
else cout << << endl << G[] * G[] <<endl;
}
return ;
}
D
#include <map>
#include <set>
#include <list>
#include <cmath>
#include <ctime>
#include <deque>
#include <stack>
#include <queue>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL long long
#define PI 3.1415926535897932626
using namespace std;
int gcd(int a, int b) {return a % b == ? b : gcd(b, a % b);}
#define MOD 1000000007
LL n,m,k;
LL mypow(LL a,LL b)
{
LL ans = ;
for (LL i = ; i <= b; i++)
ans = (ans * a) % MOD;
return ans;
}
int main()
{
while (cin >> n >> m >> k)
{
LL ans;
if(k > n || k == ) ans = mypow(m,n);
else if (k == n) ans = mypow(m,(k + )/);
else
{
if (k % ) ans = m * m;
else ans = m;
}
cout << ans <<endl;
}
return ;
}
Codeforces #107 DIV2 ABCD的更多相关文章
- Codeforces #180 div2 C Parity Game
// Codeforces #180 div2 C Parity Game // // 这个问题的意思被摄物体没有解释 // // 这个主题是如此的狠一点(对我来说,),不多说了这 // // 解决问 ...
- Codeforces #541 (Div2) - E. String Multiplication(动态规划)
Problem Codeforces #541 (Div2) - E. String Multiplication Time Limit: 2000 mSec Problem Descriptio ...
- Codeforces #541 (Div2) - F. Asya And Kittens(并查集+链表)
Problem Codeforces #541 (Div2) - F. Asya And Kittens Time Limit: 2000 mSec Problem Description Inp ...
- Codeforces #541 (Div2) - D. Gourmet choice(拓扑排序+并查集)
Problem Codeforces #541 (Div2) - D. Gourmet choice Time Limit: 2000 mSec Problem Description Input ...
- Codeforces #548 (Div2) - D.Steps to One(概率dp+数论)
Problem Codeforces #548 (Div2) - D.Steps to One Time Limit: 2000 mSec Problem Description Input Th ...
- 【Codeforces #312 div2 A】Lala Land and Apple Trees
# [Codeforces #312 div2 A]Lala Land and Apple Trees 首先,此题的大意是在一条坐标轴上,有\(n\)个点,每个点的权值为\(a_{i}\),第一次从原 ...
- Codeforces Round #412 div2 ABCD
A 按rank给出每个人的赛前分数和赛后分数 如果一个人打败了比他分数高的人 他的分数必然升高 问比赛rated吗 如果一个人的分数改变了肯定rate 如果全都没改的话 也可能是rated 这时候ch ...
- Codeforces Beta Round #107(Div2)
B.Phone Numbers 思路:就是简单的结构体排序,只是这里有一个技巧,就是结构体存储的时候,直接存各种类型的电话的数量是多少就行,在读入电话的时候,既然号码是一定的,那么就直接按照格式%c读 ...
- Codeforces #263 div2 解题报告
比赛链接:http://codeforces.com/contest/462 这次比赛的时候,刚刚注冊的时候非常想好好的做一下,可是网上喝了个小酒之后.也就迷迷糊糊地看了题目,做了几题.一觉醒来发现r ...
随机推荐
- webpack使用时可能出现的问题
1.在配置完webpack.config.js准备进行热加载开发时,修改React内容浏览器不会自动局部刷新,而且会console出一些提示: The following modules couldn ...
- pandas DataFrame的修改方法
pandas DataFrame的增删查改总结系列文章: pandas DaFrame的创建方法 pandas DataFrame的查询方法 pandas DataFrame行或列的删除方法 pand ...
- android:保存用户名密码等应用程序数据
转自http://blog.sina.com.cn/s/blog_a73687bc0101dsjj.html (一)使用SharedPreferences 1.保存信息: SharedPrefere ...
- 【转】GOOGLE-PROTOBUF与FLATBUFFERS数据的序列化和反序列化
转载自[黑米GameDev街区] 原文链接: http://www.himigame.com/unity3d-game/1607.html 关于Protobuf 通过本文的转载和分享的相关链接,足够 ...
- new String(str.getBytes(“gbk”),“gbk”)的用法详解
new String(str.getBytes(“gbk”),“gbk”)的用法详解 前提是str存放的是汉字 一.如果是new String(str.getBytes(“gbk”),“gbk”)时, ...
- 推荐一个好的Redis GUI 客户端工具
推荐一个好的Redis GUI 客户端工具 Redis Desktop Manager
- 【bzoj3362/3363/3364/3365】[Usaco2004 Feb]树上问题杂烩 并查集/树的直径/LCA/树的点分治
题目描述 农夫约翰有N(2≤N≤40000)个农场,标号1到N,M(2≤M≤40000)条的不同的垂直或水平的道路连结着农场,道路的长度不超过1000.这些农场的分布就像下面的地图一样, 图中农场用F ...
- BZOJ4524 CQOI2016伪光滑数(堆)
对于每个质数求出其作为最大质因子时最多能有几个质因子,开始时将这些ak1~akmaxk扔进堆.考虑构造方案,使得每次取出最大值后,最大质因子.质因子数均与其相同且恰好比它小的数都在堆里.类似暴搜,对于 ...
- [洛谷P4291][HAOI2008]排名系统
题目大意:三种操作: $+Name\;Socore:$上传最新得分记录,把以前的记录删除. $?Name:$ 查询玩家排名.如果两个玩家的得分相同,则先得到该得分的玩家排在前面. $?Index:$ ...
- [USACO07DEC]美食的食草动物Gourmet Grazers
---题面--- 题解: 首先观察题面,直觉上对于一头奶牛,肯定要给它配pi和qi符合条件的草中两者尽量低的草,以节省下好草给高要求的牛. 实际上这是对的,但观察到两者尽量低这个条件并不明确,无法用于 ...