题目链接:https://ac.nowcoder.com/acm/contest/5674#question
def x(i):
return 2**i
str = input()
str = str.replace("2(","x(")
print(eval(str))
#include
#define LL long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scl(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld%lld", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define PII pair
#define ll __int128
using namespace std;
const ll mod = 998244353;
inline void print(__int128 x)
{
if (x < 0)
{
x = -x;
putchar('-');
}
if (x > 9)
print(x / 10);
putchar(x % 10 + '0');
}
template
inline void read(_Tp &x)
{
char ch;
bool flag = 0;
x = 0;
while (ch = getchar(), !isdigit(ch))
if (ch == '-')
flag = 1;
while (isdigit(ch))
x = x * 10 + ch - '0', ch = getchar();
if (flag)
x = -x;
}
inline ll POW(ll a, ll b)
{
ll ans = 1;
while (b)
{
if (b & 1)
ans = ans * a % mod;
a = a * a % mod;
b >>= 1;
}
return ans;
}
map num1; //存放x质因子和需要幂的数ai
map num2; //存放y质因子和需要幂的数bi
map ans; //共同质因子和需要幂的数
int main()
{
ll a, b, c, d, x, y;
read(a);
read(b);
read(c);
read(d);
read(x);
read(y);
for (ll i = 2; i * i <= x; i++) //x质因子分解
if (x % i == 0)
{
int cnt = 0;
while (x % i == 0)
cnt++, x /= i;
num1[i] = cnt;
}
if (x != 1)
num1[x] = 1;
for (ll i = 2; i * i <= y; i++) //y质因子分解
if (y % i == 0)
{
int cnt = 0;
while (y % i == 0)
cnt++, y /= i;
num2[i] = cnt;
}
if (y != 1)
num2[y] = 1;
for (auto p : num1)
{
if (!num2[p.first])
continue;
ll pi = p.first, k1 = p.second, k2 = num2[pi];
for (ll i = a; i <= b; i++)
{
ll sh = k1 * i / k2; //j从1到sh,min都是k1*i;
//j大于sh,min都是k2*j
if (sh < c)
ans[pi] += k1 * i * (d - c + 1);
else if (sh >= d)
ans[pi] += k2 * (c + d) * (d - c + 1) / 2; //等差数列求和
else
ans[pi] += k1 * i * (d - sh) + k2 * (sh + c) * (sh - c + 1) / 2;
}
}
ll res = 1;
for (auto p : ans) //所有共同质因子幂次累乘
res = res * POW(p.first, p.second) % mod;
print(res % mod);
system("pause");
return 0;
}
#include
#define LL long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scl(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld%lld", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define PII pair
using namespace std;
const double pi = acos(-1.0);
const int mod = 1e9 + 7;
const int maxn = 1e6+5;
const int inf = 0x3f3f3f3f;
struct node{
int val,id;
bool operator < (const node &a)const{
return val
由于数据给的弱,以下代码可以水过去,要不是敲得慢,差点拿一血QAQ
#include
#define LL long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scl(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld%lld", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define PII pair
using namespace std;
const int maxn = 2e5+5;
const int inf = 0x3f3f3f3f;
int main(){
int n,m;
sc2(n,m);
vectorv;
while(n--){
int k,x,mii=inf;sc(k);
while(k--){
sc(x);
mii=min(mii,x);
}
v.push_back(mii);//每天取最便宜的
}
sort(v.begin(),v.end());//从小到大排
cout<
#include
#define LL long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scl(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld%lld", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define PII pair
using namespace std;
const int maxn = 1e5+5;
int cnt[maxn],a[maxn];
int main(){
int t;sc(t);
while(t--){
int n,x;sc(n);
mem(cnt,0);//数组清零
for(int i=1;i<=n;i++){
sc(x);
cnt[x]++;
}
int bas=0,ca=0;
for(int i=1;i<10;i++){//找第一个非零
if(cnt[i]){
bas=i;
cnt[i]--;
break;
}
}
for(int i=1;i<10;i++){//找第一个非零
if(cnt[i]){
a[++ca]=i;
cnt[i]--;
break;
}
}
for(int i=0;i<10;i++){//从小到大加入
if(cnt[i]){
while(cnt[i]--){
a[++ca]=i;
}
}
}
string b;
for(int i=ca;i>=1;i--){//从个位开始乘
t+=bas*a[i];
b+=t%10+'0';//存余数
t/=10; //进位
}
if(t)b+=t+'0'; //最后进位
reverse(b.begin(),b.end());//字符串反转
cout<
#include
#define LL long long
#define sc(a) scanf("%d", &a)
#define sc2(a, b) scanf("%d%d", &a, &b)
#define sc3(a, b, c) scanf("%d%d%d", &a, &b, &c)
#define scl(a) scanf("%lld", &a)
#define scl2(a, b) scanf("%lld%lld", &a, &b)
#define ss(a) scanf("%s", a)
#define mem(a, b) memset(a, b, sizeof(a))
#define PII pair
using namespace std;
const int maxn = 1e5+5;
vectorv[maxn];
int pre[maxn],dep[maxn],maxd[maxn];
void add(int a,int b){
v[a].push_back(b);
v[b].push_back(a);
}
void dfs(int s,int fa){ //dfs建树
for(auto i:v[s]){ //遍历子树
if(i==fa)continue; //不必跑父节点
pre[i]=s; //存放父节点
dep[i]=dep[s]+1; //子节点的深度等于父节点深度加1
maxd[i]=dep[i]; //存放子节点最深深度
dfs(i,s); //向下递归
maxd[s]=max(maxd[s],maxd[i]);//递归到根节点时,从下到上更新子节点最深深度
}
}
int main(){
int n,t;
sc2(n,t);
for(int i=1;i