摘要: 问题 cnt=cnt+a[i]*(i+1)*(n-i); 此处容易溢出,因此必须用long double 注意点 cout的格式化输出,iomanip cout<<fixed<<setprecision(2)<<cnt; 代码 #include <iostream> #include <cstdio 阅读全文
posted @ 2022-07-09 18:25 qwasdasd 阅读(35) 评论(0) 推荐(0)
摘要: 注意点 高位的0要舍去 所有位都是0的情况输出一个0 代码 #include <iostream> #include <cstdio> #include <string> using namespace std; char a[101]; char b[101]; int main(){ strin 阅读全文
posted @ 2022-07-09 17:32 qwasdasd 阅读(31) 评论(0) 推荐(0)
摘要: 注意点 输入为数字掺杂字符时,用scanf会比较方便 代码 #include <iostream> #include <cstdio> using namespace std; int a[1002]; int main(){ for(int i=0;i<1002;i++){ a[i]=0; } i 阅读全文
posted @ 2022-07-09 14:18 qwasdasd 阅读(28) 评论(0) 推荐(0)
摘要: 代码 #include <iostream> #include <cstdio> using namespace std; int main(){ int n; int a,b,c,d; int x=0,y=0; cin>>n; for(int i=0;i<n;i++){ cin>>a>>b>>c> 阅读全文
posted @ 2022-07-09 14:10 qwasdasd 阅读(24) 评论(0) 推荐(0)
摘要: 问题 测试点2格式错误,测试点2是0个可能的主元的情况,这里需要额外再加一个换行才能ac(原因不解) 思路 设置三个数组A、B、C,第一个数组A存放原本的排列,第二个数组B里的每个位置对应数组A相应位置向左的所有数的最大值,第三个数组C里的每个位置对应数组A相应位置向右的所有数的最小值。 再依次比较 阅读全文
posted @ 2022-07-09 13:52 qwasdasd 阅读(113) 评论(0) 推荐(0)
摘要: 问题 测试点2、3、4通不过,但是已经检验了多种特殊测试点,未发现问题 注意点 substr()的使用 map的使用 cin.sync()清空输入缓冲区 cin.getline()读取带空格的输入 字符串输入中带空格的情况 火星文中,如130的表示,只需要表示出高位数字,低位的0不需要显示 代码 # 阅读全文
posted @ 2022-07-09 10:47 qwasdasd 阅读(96) 评论(0) 推荐(0)