- 博客(7)
- 收藏
- 关注
原创 大数求平方根
//核心算法为get_gen()函数类似于二分查找 #include<iostream> using namespace std; int comp_str(string str1,string str2){//str1小于str2返回-1 if(str1.length()>str2.length()) return 1; if(str1.length()<...
2019-10-12 16:58:01 612
原创 code_大数加减
//似乎是有bug #include<iostream> using namespace std; char add(char a,char b,int* carry){ int tmp=a+b+*carry-'0'; if(tmp>'9'){ tmp-=10; *carry=1; }else if(tmp<'0'){...
2019-10-12 13:44:20 90
原创 code_技巧,F(k)=2*F(k-1)+2^(k-2) 迭代时不需要每次进行2的k-2次方运算
//F(k)=2*F(k-1)+2^(k-2) k>=2 #include<iostream> using namespace std; int k[21]; void market(){ k[1]=1; int pi=1; for(int i=2;i<=20;i++){ k[i]=2*k[i-1]+pi; pi&l...
2019-10-11 11:57:11 152
原创 code_技巧之大数运算字符串前添加辅助0
#include<iostream> #include<string> using namespace std; string F[1001]; /* 计算1-1000的斐波那契数 */ void market(){ int circle='0'+'9'; int tmp,carry; string Fa,Fb; F[1...
2019-10-11 11:16:12 91
原创 HDU1753 大明A+B[大数]
#include<iostream> #include<string> using namespace std; int carry=0; string get_sum(string str1,string str2){ int circle='0'+'9'; int carry=0,tmp; string max_str=str1.length()...
2019-10-11 10:25:50 69
原创 问题链接:HDU1234 开门人和关门人
#include<iostream> #include<vector> #include<algorithm> using namespace std; struct info{ char id[16]; char arrive[9]; char depart[9]; }; bool comp(char* a,char* b){ ...
2019-10-10 21:06:20 93
原创 code_detail_1
字符串,处理被字符x截断对各个子串 for(int i=0;str[i]!='\0';i++){ .... while(str[i]!='x'&&str[i]!='\0'){ ...... i++; } ... if(str[i]=='\0') break; } ...
2019-10-10 19:58:21 113
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人