7 条题解
-
3凪 (苏联战术学习部部长) LV 10 @ 2020-07-26 14:47:34
a = int(input()) s = 0 c = [] b = a i = 2 while i <= int(b**0.5)+1: if b%i == 0 : c.append(i) b = b/i i = 2 else: i += 1 if b != 1: c.append(int(b)) m = 0 for i in range(0,len(c)): if c[i] > c[i+1]: m = c[i] c[i] = c[i+1] c[i+1] = m if i == len(c) - 2: break d = str(a)+'=' for i in range(0,len(c)): d = d + str(c[i]) if i != len(c)-1: d = d + '*' print(d)
-
22020-09-16 22:45:06@
#python3
n=int(input()) n1=n list1=[] a=2 while(1): if a==n: break elif a==n1+1: break elif n1%a==0: list1.append(a) n1=n1/a a=2 else: a=a+1 c=len(list1) str1=str(n)+"=" d=0 while(1): if d==c: break elif d==0: str1=str1+str(list1[d]) d=d+1 else: str1=str1+"*"+str(list1[d]) d=d+1 print(str1)
-
22018-12-28 17:43:25@
打表法
#include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<cctype> #include<algorithm> #include<stack> #include<queue> #include<vector> #include<map> #define INF 1<<30 #define LL long long #define ULL unsigned long long using namespace std; int p[]={0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0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,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0}; int n; int main() { cin>>n; cout<<n<<"="; while(n!=1) { for(int i=2;i<=n;i++) { if(p[i]==1&&n%i==0) { cout<<i; n/=i; if(n!=1) cout<<"*"; break; } } } return 0; }
-
12018-12-24 16:05:02@
def devide(x): global i if x%i==0: if x/i==1: print(i,end='') else: print(i,end='*') x=x/i else: i=i+1 if x>1: devide(x) return '' global i i=2 n=int(input()) print(n,end='=') print(devide(n))
14行诗(划掉)
14行超长丢人版迭代法 -
02020-09-21 17:09:52@
n=int(input()) m=n print(n,end="=") for i in range(2,m): flag=1 if i!=2: for j in range(2,i): if i%j==0: flag=0 if flag: while n%i==0: n/=i if n==1: print(i,end="") else: print(i,end="*") if n!=1: print(n)
-
02020-09-21 17:09:10@
n=int(input()) m=n print(n,end="=") for i in range(2,m): flag=1 if i!=2: for j in range(2,i): if i%j==0: flag=0 if flag: while n%i==0: n/=i if n==1: print(i,end="") else: print(i,end="*") if n!=1: print(n)
-
02020-09-16 21:04:07@
超长版... 代码
import math a = int(input()) print(str(a)+"=",end="") def is_Prime(x): for i in range(2,int(math.sqrt(x))+1): if x%i==0: return False return True prime = [] for i in range(2,a): if(is_Prime(i)==True): prime.append(i) ans = [] t = True while t==True: for i in range(len(prime)): if a%prime[i]==0 and a!=prime[i]: ans.append(prime[i]) a /= prime[i] elif a==prime[i]: ans.append(prime[i]) t = False break ans.sort() for i in range(len(ans)-1): print(ans[i],end="*") print(ans[len(ans)-1])
- 1
信息
- 难度
- 4
- 分类
- (无)
- 标签
- (无)
- 递交数
- 199
- 已通过
- 84
- 通过率
- 42%
- 被复制
- 1
- 上传者