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 ...
随机推荐
- 验证码 java实现的程序
makeCheckcode.java package pic; import java.awt.Color; import java.awt.Font; import java.awt.Graphic ...
- TF-IDF与主题模型 - NLP学习(3-2)
分词(Tokenization) - NLP学习(1) N-grams模型.停顿词(stopwords)和标准化处理 - NLP学习(2) 文本向量化及词袋模型 - NLP学习(3-1) 在上一篇博文 ...
- 数据结构-排序-shell排序
shell排序 首先,希尔排序适用于待排序列关键有序. 接下来一步步图解SHELL排序 我为了方便理解内部操作.我先把代码输出整理下. #include<iostream> #includ ...
- Hibernate 查询,返回结果设置到DTO
1:原生sql的查询,返回结果设置到DTO: Query query = sessionFactoryRtData.getCurrentSession().createSQLQuery(hql.toS ...
- asp.net页面中的Console.WriteLine结果如何查看
其实用Console.WriteLine("xxxxx"),在asp.net Web程序,在输出窗口是不会输出结果的,应该用Debug.WriteLine("xxxxx& ...
- JQuery实现的智能表单提示
实现一个类似如此效果的表单验证:
- 【Linux】——搭建nexus
1.安装 前提条件: JDK已经安装,运行java -version查看. 将本地下载好的nexus存放到linux上,存放路径为 /usr/local/software.可使用winscp直接拷贝. ...
- 【EasyNetQ】- 基于topic的路由
RabbitMQ具有非常酷的功能,基于主题的路由,允许订户根据多个标准过滤消息.主题是由与消息一起发布的点分隔的单词列表.例如,“stock.usd.nyse”或“book.uk.london”或“a ...
- phpquery中文手册
[简介] phpQuery是一个基于PHP的服务端开源项目,它可以让PHP开发人员轻松处理DOM文档内容.更有意思的是,它采用了jQuery的思想,使得可以像使用jQuery一样处理页面内容,获取想要 ...
- 使用JSON数据格式模拟股票实时信息
JQueryStock.html <!DOCTYPE html> <head> <meta charset="UTF-8"> <title ...