ARC 113
A. A×B×C
https://atcoder.jp/contests/arc113/tasks/arc113_a
题意
给定一个正整数K,求出正整数排列(A,B,C),使A×B×C ≤ K,的组合个数。
思路
暴力,枚举A、B,求C的个数。
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<map>
#include<set>
#include<cstring>
#include<vector>
#include<queue>
#include<functional>
#include<string>
#define INF 0x7fffffff
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ls p<<1
#define rs p<<1|1
using namespace std;
typedef long long ll;
int k;
int main(){
IOS;
cin >> k;
ll res = 0;
for(int c = 1;c <= k;c++){
int ab = 0;
ab = k / c;
for(int a = 1;a <= ab;a++){
res += ab / a;
}
}
cout << res << endl;
system("pause");
return 0;
}
B.A ^ B ^C
https://atcoder.jp/contests/arc113/tasks/arc113_b
题意
给定三个数A,B,C,求出 a b c a^{b^c} abc的个位上的数。
思路
①由于我们只需求解个位上数,所以A的个位以上的数对结果无影响,所以我们对A取余。
②找规律,我们发现0-9中每个数的n次方的个位上的数是具有规律性的,结果如下:
③利用快速幂计算 b c b^c bc对a所在周期取余的结果
④在记录a的n次幂的个位的数组中输出结果。
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<map>
#include<set>
#include<cstring>
#include<vector>
#include<queue>
#include<functional>
#include<string>
#define INF 0x7fffffff
#define IOS ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define ls p<<1
#define rs p<<1|1
using namespace std;
typedef long long ll;
int abc[10][5];
ll pm(ll b,ll c,ll mod){
ll res = 1;
while(c){
if(c & 1){
(res *= b)%= mo


2748

被折叠的 条评论
为什么被折叠?



