
c语言,阶乘的因式分解。当g=100等比较大的时候应该怎么处理?不涉及大整数计算
c语言,阶乘的因式分解。当g=100等比较大的时候应该怎么处理?不涉及大整数计算#include<stdio.h>#include<algorithm>usingname...
c语言,阶乘的因式分解。当g=100等比较大的时候应该怎么处理?不涉及大整数计算#include<stdio.h>
#include<algorithm>
using namespace std;
struct date
{
char name[35];
int sore;
}stu[1005];
bool cmp(date a,date b)
{
return a.sore<=b.sore;
}
int main()
{
int n,mz[35],sz;
scanf("%d",&n);
char px[35];
int ps;
for(int i=0;i<n;i++)
{
scanf("%s %d",&px,&ps);//往下的此循环应是处理结构体名字相同时的情况
for(int j=0;j<i;j++)
{
if(px[i]==px[j])
{
ps[j]+=ps[i]; break;
}
}
}
sort(stu,stu+n,cmp);
printf("%s\n",stu[n-1].name);
return 0;
} 展开
#include<algorithm>
using namespace std;
struct date
{
char name[35];
int sore;
}stu[1005];
bool cmp(date a,date b)
{
return a.sore<=b.sore;
}
int main()
{
int n,mz[35],sz;
scanf("%d",&n);
char px[35];
int ps;
for(int i=0;i<n;i++)
{
scanf("%s %d",&px,&ps);//往下的此循环应是处理结构体名字相同时的情况
for(int j=0;j<i;j++)
{
if(px[i]==px[j])
{
ps[j]+=ps[i]; break;
}
}
}
sort(stu,stu+n,cmp);
printf("%s\n",stu[n-1].name);
return 0;
} 展开
1个回答
展开全部
先打一张质数表,然后对于阶乘中每个数进行质因数分解,统计每个质因数的出现次数
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询