当前位置: 首页 > news >正文

企业网站html百度云可视化小程序开发工具

企业网站html百度云,可视化小程序开发工具,郑州做网站那家做的好,网站建设宗旨是指题目 Sheng bill有着惊人的心算能力#xff0c;甚至能用大脑计算出两个巨大的数的GCD#xff08;最大公约 数#xff09;#xff01;因此他经常和别人比 赛计算GCD。有一天Sheng bill很嚣张地找到了你#xff0c;并要求和你比 赛#xff0c;但是输给Sheng bill岂不是很丢… 题目 Sheng bill有着惊人的心算能力甚至能用大脑计算出两个巨大的数的GCD最大公约 数因此他经常和别人比 赛计算GCD。有一天Sheng bill很嚣张地找到了你并要求和你比 赛但是输给Sheng bill岂不是很丢脸所以你 决定写一个程序来教训他。 输入格式 共两行 第一行一个数A。 第二行一个数B。 0 A , B ≤ 10 ^ 10000。 输出格式 一行表示A和B的最大公约数。 输入样例 12 54 输出样例 6 题解 时隔大半年我回来A这道题啦【当初写的太BUG了】 求GCD很容一想到辗转相除而高精不好操作取模这就用到了辗转相除法的本质更相减损法 GCD(a,b) GCD(a,a-b) 【a 】 然而这样会T所以我们还要优化 GCD(a,b) 2*GCD(a/2,b/2) 【2|a且2|b】 GCD(a,b) GCD(a/2,b) 【2|a】 GCD(a,b) GCD(a,b/2) 【2|b】 GCD(a,b) GCD(a,a-b) 【a 】 加上个压位高精【高精减法高精除低精高精乘低精高精比较】 就可以A了 #includeiostream #includecstdio #includecstring #includestring #includealgorithm #define LL long long int #define REP(i,n) for (int i 1; i (n); i) using namespace std; const int maxn 10005,B 4,Base 10000,maxm 100005,INF 1000000000; struct NUM{int s[maxn],len;NUM() {memset(s,0,sizeof(s)); len 0;} }; istream operator (istream in,NUM a){string s;ins;int temp 0,t 1;for (int i s.length() - 1; i 0; i--){temp temp t * (s[i] - 0);if (t * 10 Base) a.s[a.len] temp,temp 0,t 1;else t * 10;}if (temp) a.s[a.len] temp;return in; } ostream operator (ostream out,const NUM a){if (!a.len) out0;else {printf(%d,a.s[a.len]);for (int i a.len - 1; i 0; i--) printf(%04d,a.s[i]);}return out; } bool check(const NUM a){return !(a.s[1] 1);} bool equal(const NUM a,const NUM b){if (a.len ! b.len) return false;REP(i,a.len) if (a.s[i] ! b.s[i]) return false;return true; } bool operator (const NUM a,const NUM b){if (a.len b.len) return true;if (a.len b.len) return false;for (int i a.len; i 0; i--){if (a.s[i] b.s[i]) return true;if (a.s[i] b.s[i]) return false;}return false; } void Half(NUM a){int carry 0,temp;for (int i a.len; i 0; i--){temp (a.s[i] carry * Base) / 2;carry a.s[i] carry * Base - temp * 2;a.s[i] temp;}while (!a.s[a.len]) a.len--; } void Twice(NUM a){int carry 0,temp;for (int i 1; i a.len; i){temp a.s[i] * 2 carry;a.s[i] temp % Base;carry temp / Base;}while (carry) a.s[a.len] carry % Base,carry / Base; } NUM operator -(const NUM a,const NUM b){NUM c; c.len a.len;int carry 0,temp;for (int i 1; i a.len; i){temp a.s[i] - b.s[i] carry;if (temp 0) carry -1,temp Base;else carry 0;c.s[i] temp;}while (!c.s[c.len]) c.len--;return c; } int main(){NUM A,B; int cnt 0;cinAB;while (!equal(A,B)){if (check(A) check(B)) Half(A),Half(B),cnt;else if (check(A)) Half(A);else if (check(B)) Half(B);else {if (B A) swap(A,B);B B - A;}}while (cnt--) Twice(A);coutAendl;return 0; }转载于:https://www.cnblogs.com/Mychael/p/8282745.html
http://www.zqtcl.cn/news/424962/

相关文章:

  • 网站改版提示无需改版有没有兼职做设计的网站
  • 网站sem怎么做网络建设设计方案
  • wap网站在线生成做饰品网站
  • 网站主机在哪里注册呢江西的赣州网站建设
  • 零基础网站建设视频教程建筑设计专业是干什么的
  • 淘客做网站的话虚拟主机多大重庆网上房地产网签合同查询
  • 官网建站网站seo关键字优化软件
  • 网站制作的内容什么好开发板用什么语言编程
  • 医院品牌网站建设aws创建wordpress
  • dw做的网站怎么让别人看到动易网站频道栏目字体大小修改
  • 东莞网站设计公司排名辽宁建设工程信息网网上开标
  • 网站推广工具有页面素材图片
  • 网页设计搭建网站外贸求购信息平台
  • 仓库改造类网站怎么做手机创建网站的软件
  • 成都平台网站建设公司邯郸网络科技公司
  • 热门课程自己做网站大型购物网站建站
  • apache 创建网站重庆建站模板
  • 手机怎么制作网站叶县建设局网站
  • 怎么做后台网站一键更新搜索引擎优化的主要策略
  • 站酷网免费素材图库官网国外域名购买
  • 石家庄个人谁做网站天体摄影
  • 徐州集团网站建设网站排名快速提升工具
  • 自己创业做原公司一样的网站做网站要学会什么语言
  • 宿州高端网站建设公司网络业务
  • 做多语言版本网站网站收录低
  • 鼎湖网站建设江门网站优化快速排名
  • 做交通事故的网站北京物联网app开发公司
  • 网站建设中 页面网络培训注册会计师
  • app网站如何做推广安装wordpress错误
  • 八零婚纱摄影工作室网站南昌微信营销公司