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 ...
随机推荐
- 为什么mysqld启动报错
在一台ubuntu测试机器上启动一个mysql实例,本来应该是一件很简单的事情, 启动的时候却报错了: mysqld_safe --defaults-file=/etc/mysql/my3307. ...
- LeetCode 389——找不同
1. 题目 2. 解答 2.1. 方法一 将 s 和 t 转化为 Python 的列表,然后遍历列表 s 的元素,将它们从列表 t 中删除,最后列表 t 中会余下一个元素,即为所求. class So ...
- Python 学习笔记之 Numpy 库——数组基础
1. 初识数组 import numpy as np a = np.arange(15) a = a.reshape(3, 5) print(a.ndim, a.shape, a.dtype, a.s ...
- flask - 1
from flask import Flask app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, Worl ...
- htm,html,xhtml,xml,xsl,dhtml,shtm和shtml的区分
介绍一下htm,html,xhtml,xml,shtml的区分,以下内容来自百度后的知识整理. HTML和htm: HTML(Hypertext Markup Language)超文本传输语言,是ww ...
- lintcode-118-不同的子序列
118-不同的子序列 给出字符串S和字符串T,计算S的不同的子序列中T出现的个数. 子序列字符串是原始字符串通过删除一些(或零个)产生的一个新的字符串,并且对剩下的字符的相对位置没有影响.(比如,&q ...
- sudo是干哈子的
我sudo loop发现啊大家就都是root了,那么这和我直接用root起有啥区别呢? root 3826 0.0 0.1 56596 3984 pts/2 S+ 12:5 ...
- CSS3基础选择器
/*选择器分组:多个选择器使用同一个样式*/ h1,h2,a{ color: blue; } strong{ color: aquamarine; } /*选择器继承:body中未设置样式的会使用继承 ...
- JDK的弃儿:Vector、Stack、Hashtable、Enumeration
随着JDK的发展,一些设计缺陷或者性能不足的类库难免会被淘汰,最常见的就是Vector.Stack.HashTable和Enumeration了. Vector(@since 1.0) 首先看看Vec ...
- P3539 [POI2012]ROZ-Fibonacci Representation
题目描述 The Fibonacci sequence is a sequence of integers, called Fibonacci numbers, defined as follows: ...