2017 多校系列 3
2017-08-03 10:51
453 查看
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 module 109+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
Input
There are several test cases, please keep reading until EOF.
There are exact 10000 cases.
For each test case, there are 2 numbers n,k.
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 next t days,
but he is poor in counting.
He wants to know, how many days are there in the next t days,
in which he could go out and date with his female friends.
Input
There is only one test case.
The first line consists of one integer t.
The second line consists of t integers ci which
means the temperature in the next t days.
1≤t≤1000
0≤ci≤50
Output
Output an integer which means the answer.
Sample Input
5
33 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; }
未完待续。。。
相关文章推荐
- 2017 多校系列 1
- 2017 多校系列 6
- 2017 多校系列 4
- 2017 多校系列 2
- 2017 多校系列 5
- HDU 6134 && 2017 多校训练:Battlestation Operational(莫比乌斯反演+积性函数)
- 多校联合练习赛1 Problem1005 Deque LIS+LDS 再加一系列优化
- DevOps 微课系列|wiki 2017历程开发过程分享
- HDU 6162 Ch’s gift (2017多校9 - 树链剖分 + 线段树)
- 2017 多校 Function(置换群
- HDU 6055 (2017 多校训练赛2 1011)Regular polygon
- 2017 杭电多校联赛第二场 1003 Maximum Sequence(单调队列)HDU 6047
- 2017 多校 TrickGCD
- hdu 6050: Funny Function (2017 多校第二场 1006) 【找规律】
- HDU-2017 多校训练赛10-1011-Two Paths
- 2017版 Jetbrains 系列软件激活方法
- HDU6045 Is Derek lying?(规律,2017 HDU多校联赛 第2场)
- HDU-2017 多校训练赛10-补题
- hdu6047 Maximum Sequence 2017多校二1003
- 2017多校训练第二场 hdu6050 Funny Function(数学+快速幂+逆元)