2017 多校系列 3
来源:互联网 发布:卡斯柯除了软件 编辑:程序博客网 时间:2024/05/24 07:36
RXD and math
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1832 Accepted Submission(s): 745
Problem Description
RXD is a good mathematician.
One day he wants to calculate:
∑i=1nkμ2(i)×⌊nki−−−√⌋
output the answer module109+7 .
1≤n,k≤1018
μ(n)=1(n=1)
μ(n)=(−1)k(n=p1p2…pk)
μ(n)=0(otherwise)
p1,p2,p3…pk are different prime numbers
One day he wants to calculate:
output the answer module
Input
There are several test cases, please keep reading until EOF.
There are exact 10000 cases.
For each test case, there are 2 numbersn,k .
There are exact 10000 cases.
For each test case, there are 2 numbers
Output
For each test case, output "Case #x: y", which means the test case number and the answer.
Sample Input
10 10
Sample Output
Case #1: 999999937
题解:其实就是求n的k次方,用快速幂撸一遍就好了,注意取模,防止超LL
ac code:
#include<stdio.h>#include<algorithm>#include<math.h>#include<stdlib.h>#include<string.h>#include<string>//#include<iostream>//#include<vector>//#include<queue>//#include<stack>//#include<map>//#include<set>#define scand(x) scanf("%d",&x)#define scandd(x,y) scanf("%d%d",&x,&y)#define mst(a,zero) memset(a,zero,sizeof(a))#define PARITY(value) (value&1)/alue>0#define IsPowerOfTwo(n) ((!(n&(n-1)) ) && n)#define INF 0x3f3f3f3f#define intinf 1e9#define llinf 1e18#define eps 1e-8#define PI acos(-1.0)using namespace std;const int Max=1e9+7;typedef long long LL;LL fun(LL x,LL n){ LL res=1; while(n>0) { if(n & 1) res=(res*x)%Max; x=((x%Max)*(x%Max))%Max; n >>= 1; } return res;}int main(){ LL n,k,t,temp; int cas=0; while (scanf("%lld%lld",&n,&k)==2){ cas++; LL nk=fun(n,k); printf("Case #%d: %lld\n",cas,nk); } return 0;}
RXD's date
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 1426 Accepted Submission(s): 1085
Problem Description
As we all know that RXD is a life winner, therefore he always goes out, dating with his female friends.
Nevertheless, it is a pity that his female friends don't like extremely hot temperature. Due to this fact, they would not come out if it is higher than 35 degrees.
RXD is omni-potent, so he could precisely predict the temperature in the nextt days, but he is poor in counting.
He wants to know, how many days are there in the nextt days, in which he could go out and date with his female friends.
Nevertheless, it is a pity that his female friends don't like extremely hot temperature. Due to this fact, they would not come out if it is higher than 35 degrees.
RXD is omni-potent, so he could precisely predict the temperature in the next
He wants to know, how many days are there in the next
Input
There is only one test case.
The first line consists of one integert .
The second line consists oft integers ci which means the temperature in the next t days.
1≤t≤1000
0≤ci≤50
The first line consists of one integer
The second line consists of
Output
Output an integer which means the answer.
Sample Input
533 34 35 36 37
Sample Output
3
题解:赤裸裸的水题。
ac code:
#include <iostream>#include <cstdio>#include <cstring>#include <string>#include <cstdlib>#include <cmath>#include <vector>#include <list>#include <deque>#include <queue>#include <iterator>#include <stack>#include <map>#include <set>#include <algorithm>#include <cctype>using namespace std;#define si1(a) scanf("%d",&a)#define si2(a,b) scanf("%d%d",&a,&b)#define sd1(a) scanf("%lf",&a)#define sd2(a,b) scanf("%lf%lf",&a,&b)#define ss1(s) scanf("%s",s)#define pi1(a) printf("%d\n",a)#define pi2(a,b) printf("%d %d\n",a,b)#define mset(a,b) memset(a,b,sizeof(a))#define forb(i,a,b) for(int i=a;i<b;i++)#define ford(i,a,b) for(int i=a;i<=b;i++)typedef long long LL;const int N=1100001;const int M=6666666;const int INF=0x3f3f3f3f;const double PI=acos(-1.0);const double eps=1e-7;int t;int main(){ si1(t); int num=0; for(int i=0;i<t;i++) { int tmp; si1(tmp); if(tmp<=35) num++; } printf("%d\n",num); return 0;}
未完待续。。。
阅读全文
0 0
- 2017 多校系列 3
- 2017 多校系列 1
- 2017 多校系列 2
- 2017 多校系列 4
- 2017 多校系列 5
- 2017 多校系列 6
- ○ 多客系列
- [编译预处理系列3]
- StrutsCatalog系列(3)--预处理
- 西门子3系列交换机
- Learning python 系列3
- Microwindow系列(3)--开发
- [SilkyBible] XviD系列-3
- XNA系列(3)
- ORACLE 入门系列(3)
- s3c2440学习系列3
- 常用系列函数3
- 计算机基础知识扫盲系列3
- 我们的眼睛,爱眼护眼
- 0_SQL server 创建表,约束
- NoSql资料
- jsp页面静态化核心代码
- Android APK 反编译apk 如何破译apk
- 2017 多校系列 3
- 面试怪谈
- mysql索引总结----mysql 索引类型以及创建
- [编程题] 彩色瓷砖
- 随机地形生成学习笔记
- POI API讲解(一)——excel的操作
- UVA257Palinwords(哈希)
- 我们的拖延症
- Gradle刷新异常及解决办法