0
已解决
许金夫
初级天翼
初级天翼
时隔n年的拖更,我又要来更新啦~
中考过后上了六中正在集训,我会抽空更新学过的知识点
希望大家的支持~~~
--------------------
预告:下次更新huffman树的生成,编码,译码
--------------------
附上上次更新过后的代码
#include <bits/stdc++.h>
#include<windows.h>
using namespace std;
#define DIGIT 4
#define DEPTH 10000
#define MAX 30000
/*
for(int i=0;i<spn.size();i++){
cout<<spn[i];
Sleep(50);
}
*/
string ss1="|| ————请选择项目———— ||";
string ss2="|| [1]<高精度> ||";
string ss3="|| [2]<递推> ||";
string ss4="|| [3]<递归> ||";
string ss5="|| [4]<模拟> ||";
string ss6="|| [5]<埃氏筛> ||";
string ss7="|| [6]<数组> ||";
string ss8="|| [7]<数字拆分> ||";
string ss1_1="|| [1]<高精度>x+y ||";
string ss1_2="|| [2]<高精度>x-y ||";
string ss1_3="|| [3]<高精度>x*y ||";
string ss1_4="|| [4]<高精度>x/y ||";
string ss2_1="|| [1]<递推>杨辉三角 ||";
string ss2_2="|| [2]<递推>斐波那契 ||";
string ss2_3="|| [3]<递推>位数问题 ||";
string ss3_1="|| [1]<递归>八皇后 ||";
string ss3_2="|| [2]<递归>汉诺塔 ||";
string ss3_3="|| [3]<递归>排列组合 ||";
string ss3_4="|| [4]<递归>素数环 ||";
string ss4_1="|| [1]<模拟>多项式输出 ||";
string ss4_2="|| [2]<模拟>补码 ||";
string ss4_3="|| [3]<模拟>进制转换 ||";
string ss4_4="|| [4]<模拟>有序数组合并 ||";
string ss4_5="|| [5]<模拟>滑动窗口 ||";
string ss5_1="|| [1]<埃氏筛>分解质因数 ||";
string ss5_2="|| [2]<埃氏筛>质因数个数 ||";
string ss5_3="|| [3]<埃氏筛>找出质因数 ||";
string ss6_1="|| [1]<数组>二维数组循环次数 ||";
string ss6_2="|| [2]<数组>矩阵转置并求和 ||";
string sp1="有一个多项式:f(x)=a[n]*(x^n)+a[n-1]*(x^(n-1))+...+a[1]*x+a[0],其中a[n]!=0.你需要输入n和a[n],即可得出f(x)";
string sp2="八皇后问题--------一个古老而著名的问题,是回溯算法的典型案例。";
string sp3="下面将会输出所有八皇后的选项<此题在题库里无法AC>,所有的'#'代表皇后,为了方便观看,每次输出后将会稍加暂停,请耐心等待~";
string sp4="现在输入两个从小大到排列的有序数组,长度分别为m、n,就可以将这两个有序数组合并为一个长度为m+n的有序数组。";
string sp5="现在有一个长为m的数组A,给定一个整数n(n<m),请你输入所有的数值,查找A中有多少个长度为n的子数组的和为k。";
string sp6="此函数可以计算出在所有的n位数中,有多少个数字中有偶数个数字k";
string sp7="输入n,输出自然数1到n所有不重复的排列";
string sp8="输入n,组成一个环,在这个环中任意两个相邻的数字的和都是素数";
string sp9="输入合数n,把n分解成若干质因数乘积的形式";
string sp10="输入n,求出n的所有不重复的质因数个数";
string sp11="输入n,找出它的所有质因数(重复的只取一个)";
static int gEightQueen[8] = { 0 }, gCount = 0;//八皇后的定义
typedef int bignum_t[MAX+1];//高精度除法的定义
void shuxue(){
int x[5000000];
memset(x,0,sizeof(x));
cout<<"输入一组数据,**将对他进行分析"<<endl;
int n;
cout<<"这组数据的个数:";
cin>>n;
int zuju;
cout<<"组距的值为(不要告诉我你不知道组距是啥):";
cin>>zuju;
for(int i=1;i<=n;i++){
cin>>x[i];
}
cout<<endl;
sort(x+1,x+n+1);
int big=x[n];
int small=x[0];
int zushu=(big-small)/zuju+1;
cout<<"这组数据的分组组数为"<<zushu<<"个";
}
void print()//八皇后
{
cout<<"第"<<gCount<<"个八皇后排列-----------------------------------"<<endl;
cout<<" =========="<<endl;
for (int i = 0; i < 8; i++)
{
cout<<" |";
int inner;
for (inner = 0; inner < gEightQueen[i]; inner++)
cout << " ";
cout <<"#";
for (inner = gEightQueen[i] + 1; inner < 8; inner++)
cout << " ";
cout<<"|";
cout << endl;
}
cout<<" =========="<<endl;
Sleep(200);
}
int check_pos_valid(int loop, int value){//八皇后
int index;
int data;
for (index = 0; index < loop; index++)
{
data = gEightQueen[index];
if (value == data)
return 0;
if ((index + data) == (loop + value))
return 0;
if ((index - data) == (loop - value))
return 0;
}
return 1;
}
void eight_queen(int index)//八皇后
{
int loop;
for (loop = 0; loop < 8; loop++)
{
if (check_pos_valid(index, loop))
{
gEightQueen[index] = loop;
if (7 == index)
{
gCount++, print();
gEightQueen[index] = 0;
return;
}
eight_queen(index + 1);
gEightQueen[index] = 0;
}
}
}
void dg1(){//八皇后主函数
for(int i=0;i<sp2.size();i++){
cout<<sp2[i];
Sleep(50);
}
cout<<endl;
for(int i=0;i<sp3.size();i++){
cout<<sp3[i];
Sleep(50);
}
cout<<endl;
Sleep(100);
eight_queen(0);
cout << "总数为=" << gCount << endl;
}
int cc;//汉诺塔
void Move(int n, char a, char b){//汉诺塔
printf("第%d次移动 Move %d: Move from %c to %c !\n",++cc,n,a,b);
Sleep(100);
}
void Hanoi(int n, char a, char b, char c)//汉诺塔
{
if (n == 1)
{
Move(n, a, c);
}
else
{
Hanoi(n - 1, a, c, b);
Move(n, a, c);
Hanoi(n - 1, b, a, c);
}
}
void dg2(){//汉诺塔主函数
int n=8;
printf("汉诺塔的层数:\n");
scanf(" %d",&n);
Hanoi(n, 'A', 'B', 'C');
}
int used[10];
int pl[10];
int n,cnt=0;
void dfs1(int t){
if(t>n){
for(int i=1;i<=n;i++){
cout<<pl[i]<<" ";
}
cout<<endl;
return ;
}
for(int i=1;i<=n;i++){
if(used[i]==0){
pl[t]=i;
used[i]=1;
dfs1(t+1);
used[i]=0;
}
}
}
void dg3(){
for(int i=0;i<sp7.size();i++){
cout<<sp7[i];
Sleep(50);
}
cout<<endl<<"n的数值=";
cin>>n;
dfs1(1);
}
int n1, used1[25], a1[25], cnt1;
bool isprime(int x, int y) {
int s = x + y;
if(s==0) return false;
for(int i=2; i<=sqrt(s); i++) {
if(s%i==0) return false;
}
return true;
}
void dfs(int t) {
if(t==n1+1) {
if(isprime(a1[1], a1[t-1])) {
cnt1 ++;
for(int i=1; i<=n1; i++) {
cout << a1[i] << ' ';
}
cout << endl;
}
return ;
}
for(int i=1; i<=n1; i++) {
if(used1[i]==0 && (isprime(a1[t-1], i) || t==1)) {
a1[t] = i;
used1[i] = 1;
dfs(t+1);
used1[i] = 0;
}
}
}
void dg4() {
for(int i=0;i<sp8.size();i++){
cout<<sp8[i];
Sleep(50);
}
cout<<endl<<"数值n=";
cin >> n1;
dfs(1);
cout <<"总方案数="<< cnt1;
}
void gj1(){//高精度加法
int a[100005];
int b[100005];
int c[100005];
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(c,0,sizeof(c));
string s1,s2;
cout<<"加数x:";
cin>>s1;
cout<<"加数y:";
cin>>s2;
a[0]=s1.size();
b[0]=s2.size();
for(int i=1;i<=s1.size();i++)a[i]=int(s1[a[0]-i]-'0');
for(int i=1;i<=s2.size();i++)b[i]=int(s2[b[0]-i]-'0');
c[0]=max(a[0],b[0]);
int jw=0;
for(int i=1;i<=c[0];i++){
c[i]=a[i]+b[i]+jw;
jw=c[i]/10;
c[i]%=10;
}
if(jw==1){
c[0]++;
c[c[0]]=jw;
}
cout<<"x+y=";
for(int i=c[0];i>=1;i--){
cout<<c[i];
}
}
void gj2(){//高精度减法
string sd,se,sa;
int a[100001]={0},b[100001]={0},c[100001]={0},mc,me,mz,n,mo=0;
cout<<"减数x:";
cin>>sd;
cout<<"减数y:";
cin>>se;
mc=sd.size();
me=se.size();
if(mc<me||mc==me&&sd<se){sa=sd;sd=se;se=sa;n=mc;mc=me;me=n;mo=-1;}
for(int i=1;i<=mc;i++) a[i]=sd[mc-i]-'0';
for(int i=1;i<=me;i++) b[i]=se[me-i]-'0';
int i=1,o=0;
while(i<=mc||i<=me)
{
if(a[i]<b[i]){a[i+1]--;a[i]+=10;}
c[i]=a[i]-b[i];
i++;
}
mz=i;while(c[mz]==0&&mz>1)mz--;
cout<<"x-y=";
if(mo==-1) cout<<"-";
for(int i=mz;i>=1;i--) cout<<c[i];
}
void gj3(){//高精度乘法
string sa="",sb="",st="";
int la=0,lb=0,lc=0,tla=0,tlb=0,t=0;
bool isuselesszero=true;
vector <int> a,b,c;
cout<<"乘数x:";
cin>>sa;
cout<<"乘数y:";
cin>>sb;
if(sa[0]=='0' || sb[0]=='0') {
cout<<0;
return ;
}
la=sa.length(); lb=sb.length();
if(la>lb){
swap(sa,sb);
la=sa.length();
lb=sb.length();
}
lc=max(la,lb);
tla=la;
tlb=lb;
reverse(sa.begin(),sa.end());
reverse(sb.begin(),sb.end());
while(tla<lc){
sa+='0';
tla=sa.length();
}
while(tlb<lc){
sb+='0';
tlb=sb.length();
}
for(int i=0;i<1000000;i++) c.push_back(0);
for(int i=0;i<lc;i++){
a.push_back((sa[i]-'0'));
b.push_back((sb[i]-'0'));
}
for(int i=0;i<lb;i++){
for(int j=0;j<la;j++){
c[i+j]+=a[j]*b[i];
if(c[i+j]>=10){
c[i+j+1]+=c[i+j]/10;
c[i+j]%=10;
}
}
}
reverse(c.begin(),c.end());
cout<<"x*y=";
for(int i=0;i<1000000;i++){
if(isuselesszero&&c[i]==0) continue;
if(c[i]!=0) isuselesszero=false;
if(c[i]<10) cout<<c[i];
else{
c[i-1]=c[i]/10;
c[i]%=10;
cout<<c[i];
}
}
return ;
}
int read(bignum_t a,istream& is=cin){ //高精度除法
char buf[MAX*DIGIT+1],ch;
int i,j;
memset((void*)a,0,sizeof(bignum_t));
if (!(is>>buf)) return 0;
for (a[0]=strlen(buf),i=a[0]/2-1;i>=0;i--)
ch=buf[i],buf[i]=buf[a[0]-1-i],buf[a[0]-1-i]=ch;
for (a[0]=(a[0]+DIGIT-1)/DIGIT,j=strlen(buf);j<a[0]*DIGIT;buf[j++]='0');
for (i=1;i<=a[0];i++)
for (a[i]=0,j=0;j<DIGIT;j++)
a[i]=a[i]*10+buf[i*DIGIT-1-j]-'0';
for (;!a[a[0]]&&a[0]>1;a[0]--);
return 1;
}
void write(const bignum_t a,ostream& os=cout){ //高精度除法
int i,j;
for (os<<a[i=a[0]],i--;i;i--)
for (j=DEPTH/10;j;j/=10)
os<<a[i]/j%10;
}
void sub(bignum_t a,const bignum_t b,const int c,const int d){ //高精度除法
int i,O=b[0]+d;
for (i=1+d;i<=O;i++)
if ((a[i]-=b[i-d]*c)<0)
a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH;
for (;a[i]<0;a[i+1]+=(a[i]-DEPTH+1)/DEPTH,a[i]-=(a[i]-DEPTH+1)/DEPTH*DEPTH,i++);
for (;!a[a[0]]&&a[0]>1;a[0]--);
}
int comp(const bignum_t a,const int c,const int d,const bignum_t b){ //高精度除法
int i,t=0,O=-DEPTH*2;
if (b[0]-a[0]<d&&c)
return 1;
for (i=b[0];i>d;i--){
t=t*DEPTH+a[i-d]*c-b[i];
if (t>0) return 1;
if (t<O) return 0;
}
for (i=d;i;i--){
t=t*DEPTH-b[i];
if (t>0) return 1;
if (t<O) return 0;
}
return t>0;
}
void div(bignum_t c,bignum_t a,const bignum_t b){//高精度除法
int h,l,m,i;
memset((void*)c,0,sizeof(bignum_t));
c[0]=(b[0]<a[0]+1)?(a[0]-b[0]+2):1;
for (i=c[0];i;sub(a,b,c[i]=m,i-1),i--)
for (h=DEPTH-1,l=0,m=(h+l+1)>>1;h>l;m=(h+l+1)>>1)
if (comp(b,m,i-1,a)) h=m-1;
else l=m;
for (;!c[c[0]]&&c[0]>1;c[0]--);
c[0]=c[0]>1?c[0]:1;
}
void gj4(){
bignum_t a,b,c;
cout<<"被除数a为:";
read(a);
cout<<"除数b为:";
read(b);
div(c,a,b);
cout<<"a/b=";
write(c);
cout<<endl;
cout<<"a%b=";
write(a);
cout<<endl;
}
void dt1(){//杨辉三角
cout<<"三角的层数:";
int n;
cin>>n;
const int m = 2 * n-1;
int arr[n + 1][m] = { 0 };
for (int i = 0; i < n; i++)
{
arr[i][n - i- 1] = 1;
arr[i][n + i -1] = 1;
}
for (int i = 2; i < n; i++)
{
for (int j = n - i + 1; j < n-2+i; j = j + 2)
arr[i][j] = arr[i - 1][j - 1] + arr[i - 1][j + 1];
}
int p;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n - i - 1; j++)
cout << " ";
p = 1;
for (int j = n - i - 1; p < i + 2; j = j + 2)
{
cout << setw(4) << arr[i][j] << " ";
p = p + 1;
}
cout << endl;
}
}
void dt2(){//斐波那契数列
int a[10000],b[10000];
string s1="1",s2="1";
char x[1200];
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
int s,n,sum;
cout<<"你求的是第几个数列:";
cin>>n;
for(int j=2;j<n;j++) {
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
a[0]=s1.size();
b[0]=s2.size();
for(int i=1;i<=a[0];i++){
a[i]=s1[a[0]-i]-'0';
}
for(int i=1;i<=b[0];i++){
b[i]=s2[b[0]-i]-'0';
}
sum=max(a[0],b[0]);
for(int i=1;i<=sum;i++){
a[i]+=b[i];
a[i+1]+=a[i]/10;
a[i]%=10;}
sum++;
while(!(a[sum])&&(sum>1))sum--;
s=0;
for(int i=sum;i>=1;i--)x[s++]=a[i]+'0';
s1=s2;
s2=x;
}
cout<<s2;
}
void dt3(){
int j[100005];
int o[100005];
memset(j,0,sizeof(j));
memset(j,0,sizeof(j));
for(int i=0;i<sp6.size();i++){
cout<<sp6[i];
Sleep(50);
}
cout<<endl;
j[1]=1;
o[1]=8;
int n,k;
cout<<"位数n=";
cin>>n;
cout<<"数字k=";
cin>>k;
for(int i=2;i<=n;i++){
j[i]=j[i-1]*9+o[i-1];
o[i]=o[i-1]*9+j[i-1];
}
cout<<n<<"位数**有"<<o[n]<<"个数有偶数个"<<k;
}
void moni1(){
int t[101];
memset(t,-1,sizeof(t));
for(int i=0;i<sp1.size();i++){
cout<<sp1[i];
Sleep(50);
}
int n, p;
bool f = true;
cout<<endl<<"n=";
cin >> n;
p = n;
for(int i=1; i<=n+1; i++) {
cout<<"t["<<i<<"]=";
cin>>t[i];
}
cout<<"f(x)=";
for(int i=1; i<=n+1; i++) {
if(t[i]==0) {
p --;
continue;
}
if(t[i]<0) cout << "-";
if(t[i]>0 && !f) {
cout << "+";
}
if(abs(t[i])!=1 || p==0) cout << abs(t[i]);
if(p>0) cout << "x";
if(p>1) cout << "^" << p;
p --;
f = false;
}
}
void moni2(){
cout<<"输入一个正整数二进制:";
string s;
cin >> s;
cout<<s<<"的相反数的八位二进制补码=";
int n = 7 - s.size();
for(int i=1; i<=n; i++) {
s = '0' + s;
}
for(int i=0; i<s.size(); i++) {
if(s[i]=='0') s[i] = '1';
else s[i] = '0';
}
for(int i=s.size()-1; i>=0; i--) {
if(s[i]=='0') {
s[i] = '1';
break;
}
s[i] = '0';
}
cout << 1 << s;
}
void moni3(){
string s="0123456789ABCDEFGHIJ";
string ans="";
int n,k;
cout<<"十进制数x=";
cin>>n;
cout<<"k进制=";
cin>>k;
cout<<n<<"转化为"<<k<<"进制=";
while(n){
ans=s[n%k]+ans;
n/=k;
}
cout<<ans;
}
void moni4(){
for(int i=0;i<sp4.size();i++){
cout<<sp4[i];
Sleep(50);
}
cout<<endl;
int a[1005], b[1005], c[2005], m=0, n=0;
memset(a,0,sizeof(a));
memset(b,0,sizeof(b));
memset(c,0,sizeof(c));
cout<<"a数组的长度m=";
cin >> m ;
cout<<"b数组的长度n=";
cin >> n ;
cout<<"a数组的数值:";
for(int i=1; i<=m; i++) {
cin >> a[i];
}
cout<<"b数组的数值:";
for(int i=1; i<=n; i++) {
cin >> b[i];
}
cout<<"合并后的数组为:";
int i = 1, j = 1, k = 0;
while(i<=m && j<=n) {
if(a[i] < b[j]) {
c[++k] = a[i];
i ++;
}else {
c[++k] = b[j];
j ++;
}
}
while(i<=m) {
c[++k] = a[i];
i ++;
}
while(j<=n) {
c[++k] = b[j];
j ++;
}
for(int i=1; i<=k; i++) {
cout << c[i] << ' ';
}
}
void moni5(){
for(int i=0;i<sp5.size();i++){
cout<<sp5[i];
Sleep(50);
}
cout<<endl;
int a[10005];
memset(a,0,sizeof(a));
int n, m, cnt = 0, t = 0 , k;
cout<<"输入数组A的长度m:";
cin >> n ;
cout<<"输入子数组的长度n:";
cin >> m ;
cout<<"子数组的和k=";
cin >> k ;
cout<<"A数组的数值为:";
for(int i=1; i<=n; i++)
cin >> a[i];
for(int i=0; i<m; i++) {//初始化窗口
t += a[i];
}
for(int i=m; i<=n; i++) {//模拟窗口滑动的过程
t += a[i] - a[i-m];
if(t == k) cnt ++;
}
cout << "符合的子数组的数量=";
cout << cnt;
}
void ass1(){
for(int i=0;i<sp9.size();i++){
cout<<sp9[i];
Sleep(50);
}
cout<<endl<<"合数n1=";
int n1,i=2;
cin>>n1;
cout<<n1<<"=";
do{
while(n1%i==0){
cout<<i;
n1/=i;
if(n1!=1)
cout<<"*";
}
i++;
}
while(n1!=1);
}
void ass2(){
for(int i=0;i<sp10.size();i++){
cout<<sp10[i];
Sleep(50);
}
cout<<endl;
cout<<"正整数n=";
long long number;
cin>>number;
int a ;
for(int i=2;i<=number/2;i++){
if(number%i==0){
int j;
for(j=2;j<=sqrt(i);j++){
if(i%j==0){
break;
}
}
if(j>sqrt(i)){
a++;
}
}
}
cout<<number<<"的不重复质因数的个数为:";
cout << a ;
}
void ass3(){
for(int i=0;i<sp11.size();i++){
cout<<sp11[i];
Sleep(50);
}
cout<<endl;
long long number;
cout<<"n的值为:";
cin>>number;
cout<<"n的所有质因数=";
for(int i=2;i<=number;i++){
if(number%i==0){
int j;
for(j=2;j<=sqrt(i);j++){
if(i%j==0){
break;
}
}
if(j>sqrt(i)){
cout<<i<<" ";
}
}
}
}
void sz1(){
cout<<"输入二维数组的行数和列数,得到输入时循环多少次"<<endl;
cout<<"二维数组的个数:";
int n;
cin>>n;
int a,b;
for(int i=0;i<n;i++){
cout<<"行数:";
cin>>a;
cout<<"列数:";
cin>>b;
cout<<"循环次数:";
cout<<a*b<<endl;
}
}
void sz2(){
cout<<"给定一个m*n的矩阵,求该矩阵的转置矩阵,再与一个n*m的矩阵求和,输出求和后的矩阵"<<endl;
cout<<"m=";
int n,m;
cin>>n;
cout<<"n=";
cin>>m;
cout<<"转置前的矩阵:"<<endl;
int a[n+10][m+10],b[m+10][n+10],c[m+10][n+10];
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
{
cin>>a[i][j];
}
}
cout<<"另一个矩阵:"<<endl;
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
cin>>b[i][j];
}
}
cout<<"计算后的矩阵矩阵:"<<endl;
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
c[i][j]=a[j][i];
}
}
for(int i=1;i<=m;i++)
{
for(int j=1;j<=n;j++)
{
cout<<c[i][j]+b[i][j]<<" ";
}
cout<<endl;
}
}
void print(const char a[],int b){
int s=strlen(a);
for(int i=0;i<s;i++){
printf("%c",a[i]);
Sleep(b);
}
}
void Initialize(){
system("color f0");
RECT rect;
HWND hwnd=GetForegroundWindow();
GetWindowRect(hwnd,&rect);
MoveWindow(hwnd,0,0,rect.right-rect.left,rect.bottom-rect.top,TRUE);
system("mode con cols=90 lines=30");
}
void cursor(bool a){
HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_CURSOR_INFO CursorInfo;
GetConsoleCursorInfo(handle, &CursorInfo);
CursorInfo.bVisible = a;
SetConsoleCursorInfo(handle, &CursorInfo);
}
void gotoxy(int x,int y){
COORD pos;
pos.X=2*x;
pos.Y=y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),pos);
}
void welcome(){
Initialize();
cursor(0);
gotoxy(15,11);print("自定义计算-2.0<常规算法>",75);
gotoxy(22,12);print("by 夜阑",75);
Sleep(600);system("cls");
Sleep(500);
system("cls");
gotoxy(16,11);print("[夜阑]的个人博客luogu",50);
gotoxy(7,12);print("https://www.luogu.com.cn/blog/34010420060215701X/",50);
Sleep(500);
gotoxy(17,13);print("F键进入个人博客",50);
Sleep(600);
gotoxy(15,11);print("请输入任意键继续... ...",50);
char k=cin.get();
if(k=='F')system("start https://www.luogu.com.cn/blog/34010420060215701X/");
system("cls");
return;
}
int main(){
welcome();
cout << endl << endl << endl << endl ;
gotoxy(16,11);print("------- 自定义计算 2.0 -------",50);
gotoxy(16,11);print(" Hello again :) ",50);
char k=cin.get();
int qw=1;
while(qw==1){
system("cls");
cout<<endl<<endl<<endl<<endl;
cout<<ss1<<endl;
cout<<ss2<<endl;
cout<<ss3<<endl;
cout<<ss4<<endl;
cout<<ss5<<endl;
cout<<ss6<<endl;
cout<<ss7<<endl;
int xuanxiang;//选项------------------------------------------------------------
cout<<"请选择功能:";
cin>>xuanxiang;
if(xuanxiang==1){//高精度
system("cls");
cout<<ss1<<endl;
cout<<ss1_1<<endl;
cout<<ss1_2<<endl;
cout<<ss1_3<<endl;
cout<<ss1_4<<endl;
int xuanxiang1;
cout<<"你的选择:";
cin>>xuanxiang1;
if(xuanxiang1==1){
system("cls");
gj1();
Sleep(500);
}
else if(xuanxiang1==2){
system("cls");
gj2();
Sleep(500);
}
else if(xuanxiang1==3){
system("cls");
gj3();
Sleep(500);
}
else if(xuanxiang1==4){
system("cls");
gj4();
Sleep(500);
}
}
else if(xuanxiang==2){//递推
system("cls");
cout<<ss1<<endl;
cout<<ss2_1<<endl;
cout<<ss2_2<<endl;
cout<<ss2_3<<endl;
int xuanxiang1;
cout<<"你的选择:";
cin>>xuanxiang1;
if(xuanxiang1==1){
system("cls");
dt1();
Sleep(500);
}
else if(xuanxiang1==2){
system("cls");
dt2();
Sleep(500);
}
else if(xuanxiang1==3){
system("cls");
dt3();
Sleep(500);
}
}
else if(xuanxiang==3){//递归
system("cls");
cout<<ss1<<endl;
cout<<ss3_1<<endl;
cout<<ss3_2<<endl;
cout<<ss3_3<<endl;
cout<<ss3_4<<endl;
int xuanxiang1;
cout<<"你的选择:";
cin>>xuanxiang1;
if(xuanxiang1==1){
system("cls");
dg1();
gCount=0;
Sleep(500);
}
else if(xuanxiang1==2){
system("cls");
dg2();
cc=0;
Sleep(500);
}
else if(xuanxiang1==3){
system("cls");
dg3();
Sleep(500);
n,cnt=0;
}
else if(xuanxiang1==4){
system("cls");
dg4();
Sleep(500);
n1,cnt1=0;
}
}
else if(xuanxiang==4){//模拟
system("cls");
cout<<ss1<<endl;
cout<<ss4_1<<endl;
cout<<ss4_2<<endl;
cout<<ss4_3<<endl;
cout<<ss4_4<<endl;
cout<<ss4_5<<endl;
int xuanxiang1;
cout<<"你的选择:";
cin>>xuanxiang1;
if(xuanxiang1==1){
system("cls");
moni1();
Sleep(500);
}
else if(xuanxiang1==2){
system("cls");
moni2();
Sleep(500);
}
else if(xuanxiang1==3){
system("cls");
moni3();
Sleep(500);
}
else if(xuanxiang1==4){
system("cls");
moni4();
Sleep(500);
}
else if(xuanxiang1==5){
system("cls");
moni5();
Sleep(500);
}
}
else if(xuanxiang==5){//埃氏筛
system("cls");
cout<<ss1<<endl;
cout<<ss5_1<<endl;
cout<<ss5_2<<endl;
cout<<ss5_3<<endl;
int xuanxiang1;
cout<<"你的选择:";
cin>>xuanxiang1;
if(xuanxiang1==1){
system("cls");
ass1();
Sleep(500);
}
else if(xuanxiang1==2){
system("cls");
ass2();
Sleep(500);
}
else if(xuanxiang1==3){
system("cls");
ass3();
Sleep(500);
}
}
else if(xuanxiang==6){//数组
system("cls");
cout<<ss1<<endl;
cout<<ss6_1<<endl;
cout<<ss6_2<<endl;
int xuanxiang1;
cout<<"你的选择:";
cin>>xuanxiang1;
if(xuanxiang1==1){
system("cls");
sz1();
Sleep(500);
}
else if(xuanxiang1==2){
system("cls");
sz2();
Sleep(500);
}
}
cout<<endl;
cout<<"是否退出?"<<endl;
cout<<"[1]:继续"<<endl;
cout<<"[0]:退出"<<endl;
cout<<"你的选择:";
cin>>qw;
} system("cls");
gotoxy(16,11);print("see you next time",50);
cout<<endl<<endl<<endl<<endl<<endl;
return 0;
}
将要更的截图:
许金夫在2021-08-16 22:23:54追加了内容
希望没有抄袭~~~~~~~~~~~~~~~~
许金夫在2021-08-17 12:39:49追加了内容
大家把希望加入的算法说出来~~~~~
0
0
0
0
0
0
0
0
0
0