【洛谷p1932】A+B A-B A*B A/B A%B Problem

(emmmm)

这道题成功让我见识到了Dev撤回的高端大气上档(dàng)次。

A+B A-B A*B A/B A%B Problem【传送门】(真是个优秀的高精)

算法:::::::(模板题弄这么费劲干什么??)


 

先说一下,代码没有完成!没有完成!没有完成!(高精除放弃)

 1  #include<iostream>//代码未ac
 2  #include<cstdio>
 3  #include<cmath>
 4  #include<algorithm>
 5  #include<string>
 6  #include<cstring>
 7  using namespace std;
 8  char a1[1010],b1[1010];
 9  int a[1010],b[1010],d[1010],e[1010],lena,lenb,lend;
10  int c[10000001];
11  void sum();
12  void difference();
13  void product();
14  int main()
15  {
16      scanf("%s",a1);
17      scanf("%s",b1);
18      lena=strlen(a1);
19      lenb=strlen(b1);
20      for(int i=0;i<lena;i++){a[lena-i]=a1[i]-48;d[lena-i]=a[lena-i];}
21      for(int i=0;i<lenb;i++){b[lenb-i]=b1[i]-48;e[lenb-i]=b[lenb-i];}
22      sum();
23      difference();
24      product();
25  }
26  void sum()
27  {
28      int x=0,lenc=1;memset(c,0,sizeof(c));
29      while(lenc<=lena||lenc<=lenb){
30          c[lenc]=a[lenc]+b[lenc]+x;
31          x=c[lenc]/10;
32          c[lenc]%=10;                                                  
33          lenc++;                                                
34      }c[lenc]=x;
35      if(c[lenc]==0)lenc--;
36      for(int i=lenc;i>=1;i--)cout<<c[i];
37      cout<<endl;
38  }
39  void difference()
40  {
41      memset(c,0,sizeof(c));
42      if(strcmp(a1,b1)==0)
43          cout<<strcmp(a1,b1)<<endl;
44      else{
45          if(lena<lenb||(lena==lenb&&strcmp(a1,b1)<0)){
46              cout<<"-";
47              int i=1;
48              while(i<=lena||i<=lenb){
49                  if(b[i]<a[i]){b[i]+=10;b[i+1]--;}
50              c[i]=b[i]-a[i];
51              i++;}lend=i;}
52          else {
53              int i=1;
54              while(i<=lena||i<=lenb){
55                  if(b[i]>a[i]){a[i]+=10;a[i+1]--;}
56              c[i]=a[i]-b[i];
57              i++;}lend=i;}
58              while((c[lend]==0)&&lend>1)lend--;
59              for(int j=lend;j>=1;j--)cout<<c[j];
60                cout<<endl;
61          }
62      }
63  void product()
64  {
65      memset(c,0,sizeof(c));
66      for(int i=1;i<=lena;i++){int x=0;
67          for(int j=1;j<=lenb;j++){
68              c[i+j-1]=d[i]*e[j]+x+c[i+j-1];
69              x=c[i+j-1]/10;
70              c[i+j-1]%=10;
71          }c[i+lenb]=x;
72      }                               
73      int lene=lena+lenb;
74      while(c[lene]==0&&lene>1)lene--;
75      for(int i=lene;i>=1;i--)cout<<c[i];
76      cout<<endl;
77  }//(可劲压行也没压下去)

 

 

 

这个撤回真的如同韩学长说的:撤着撤着就不知道去哪了??害得我又改了好多……(好迷)

嗯end-(悄咪咪地讲我用python水过的这个题)

转载于:https://www.cnblogs.com/zhuier-xquan/p/10605984.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
At its core, Bayes' Theorem is a simple probability and statistics formula that has revolutionized how we understand and deal with uncertainty. If life is seen as black and white, Bayes' Theorem helps us think about the gray areas. When new evidence comes our way, it helps us update our beliefs and create a new belief. Ready to dig in and visually explore Bayes' Theorem? Let’s go! Over 60 hand-drawn visuals are included throughout the book to help you work through each problem as you learn by example. The beautifully hand-drawn visual illustrations are specifically designed and formatted for the kindle. This book also includes sections not found in other books on Bayes' Rule. These include: A short tutorial on how to understand problem scenarios and find P(B), P(A), and P(B|A). - For many people, knowing how to approach scenarios and break them apart can be daunting. In this booklet, we provide a quick step-by-step reference on how to confidently understand scenarios. A few examples of how to think like a Bayesian in everyday life. Bayes' Rule might seem somewhat abstract, but it can be applied to many areas of life and help you make better decisions. Learn how Bayes can help you with critical thinking, problem-solving, and dealing with the gray areas of life. A concise history of Bayes' Rule. - Bayes' Theorem has a fascinating 200+ year history, and we have summed it up for you in this booklet. From its discovery in the 1700’s to its being used to break the German’s Enigma Code during World War 2. Fascinating real-life stories on how Bayes' formula is used everyday.From search and rescue to spam filtering and driverless cars, Bayes is used in many areas of modern day life. An expanded Bayes' Theorem definition, including notations, and proof section. - In this section we define core elementary bayesian statistics terms more concretely. A recommended readings sectionFrom The Theory That Would Not Die to Think Bayes: Bayesian Statistics in Pythoni> and many more, there are a number of fantastic resources we have collected for further reading.
rfc是网络协义的重要学习资源,为方便大家查看,特收藏整理如下。下面是其中一篇内容: Network Working Group Steve Crocker Request for Comments: 1 UCLA 7 April 1969 Title: Host Software Author: Steve Crocker Installation: UCLA Date: 7 April 1969 Network Working Group Request for Comment: 1 CONTENTS INTRODUCTION I. A Summary of the IMP Software Messages Links IMP Transmission and Error Checking Open Questions on the IMP Software II. Some Requirements Upon the Host-to-Host Software Simple Use Deep Use Error Checking III. The Host Software Establishment of a Connection High Volume Transmission A Summary of Primitives Error Checking Closer Interaction Open Questions Crocker [Page 1] RFC 1 Host Software 7 April 1969 IV. Initial Experiments Experiment One Experiment Two Introduction The software for the ARPA Network exists partly in the IMPs and partly in the respective HOSTs. BB&N has specified the software of the IMPs and it is the responsibility of the HOST groups to agree on HOST software. During the summer of 1968, representatives from the initial four sites met several times to discuss the HOST software and initial experiments on the network. There emerged from these meetings a working group of three, Steve Carr from Utah, Jeff Rulifson from SRI, and Steve Crocker of UCLA, who met during the fall and winter. The most recent meeting was in the last week of March in Utah. Also present was Bill Duvall of SRI who has recently started working with Jeff Rulifson. Somewhat independently, Gerard DeLoche of UCLA has

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值