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 ...
随机推荐
- 第三十四篇 Python面向对象之 反射(自省)
什么是反射? 反射的概念是由Smith在1982年提出的,主要是指程序可以访问.检测和修改它本身状态或行为的一种能力(自省).这一概念的提出很快引发了计算机科学领域关于应用反射性的研究.它首先被程序语 ...
- P5056 插头dp
题面 Source: unordered_map: #include <iostream> #include <tr1/unordered_map> #include < ...
- LINUX系统下Java和Scala的环境配置
最近,笔者在研究一个有关“自然语言处理”的项目,在这个项目中,需要我们用Spark进行编程.而Spark内核是由Scala语言开发的,所以在使用Spark之前,我们必须配置好Scala,而Scala又 ...
- 学习人工智能的第五个月[字典学习[Dictionary Learning,DL]]
摘要: 大白话解释字典学习,分享第五个月的学习过程,人生感悟,最后是自问自答. 目录: 1.字典学习(Dictionary Learning,DL) 2.学习过程 3.自问自答 内容: 1.字典学习( ...
- ipfs01
IPFS音乐播放器 IPFS相关 IPFS第一次亲密接触 什么是IPFS IPFS对比HTTP/FTP等协议的优势 IPFS应用场景 ipfs入门 官网地址:https://ipfs.io 下载安 ...
- bbbbbeta
about beta 写在开头:(小声bb,无任何专业知识) 好了正文开始了 = = beta冲刺对于来说可能是让我觉得非常有成就感的叭,相比于alpha,每天都能写代码的感觉真好鸭(认真脸)(虽然天 ...
- nginx安装-del
1.检测是否安装 rpm -q xxx2. 安装nginx前,我们首先要确保系统安装了g++.gcc.openssl-devel.pcre-devel和zlib-devel软件,可通过如图所示命令进行 ...
- js表单验证工具包
常用的js表单验证方法大全 /* 非空校验 : isNull() 是否是数字: isNumber(field) trim函数: trim() lTrim() rTrim() 校验字符串是否为空: ch ...
- visio应用程序相关设置-选项-视图
1.是否显示"新建"选项卡,可读/写 ApplicationSettings.ShowChooseDrawingTypePane m_Visio.Window.Applicatio ...
- 【模拟赛·polyline】
Input file: polyline.in Output file: polyline.out Time limit: 1s Memory limit: 128M 有若⼲个类似于下⾯的函数: 定义 ...