11 条题解

  • 6
    @ 2023-5-20 3:27:39

    解析:

    输入甲流确诊数a和死亡数b,计算死亡率。

    小数形式的死亡率为b/ab / a,转化为百分比的形式需要对结果乘以100,再加上一个百分号,即b/a100b / a * 100加上%。

    参考代码:

    #include <iostream>
    #include <iomanip>
    using namespace std;
    int main()
    {
        double a, b;
        cin >> a >> b;
        cout << fixed << setprecision(3) << b / a * 100 << "%";
        return 0;
    }
    
    • 2
      @ 2023-8-4 21:37:44
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          int a,b;
          cin>>a;
          cin>>b;
          cout<<fixed<<setprecision(3)<<1.0*b/a*100<<"%"<<endl;
          return 0;
      }
      

      🔶注意要精确到小数点的后三位哦

      • 2
        @ 2023-7-23 16:25:39
        #include <bits/stdc++.h> 
        using namespace std;
        int main(){
        	double f,c,d;
        	cin>>f>>c;
        	d=1.0*(c/f)*100;
        	cout << fixed << setprecision(3) << d << "%" << endl;
        }
        
        • 1
          @ 2023-6-23 11:41:31
          #include <iostram>
          include <iomaip>
          using namepace std;
          in main()
          {
            double a;
            doube b
             cin>>a
              cin>b;
              double s=(b/a)
              s*=100;
          cout<<fixd<<stprecisin(3)<<s<<"%";
              retun 0;
          }//大概看一下,看懂就可以,为了防止你复制,我加了很多bug
          
          • 1
            @ 2023-5-21 16:14:58

            最短代码:

            #include <bits/stdc++.h>
            using namespace std;
            signed main()
            {
                double a, b;
            	cin >> a >> b;
            	printf("%.3lf%%", b * 100 / a);
            	return 0;
            }
            

            参考了洛谷几位神犇的代码

            • @ 2023-6-10 14:00:17
              #include <bits/stdc++.h>
              int main()
              {
                  double a, b;
              	std::cin >> a >> b;
              	std::printf("%.3lf%%", b * 100 / a);
              	return 0;
              }
              

              哈哈哈,比你更短!

            • @ 2023-6-18 10:20:59

              6

            • @ 2023-6-27 11:27:05

              @

              #include <bits/stdc++.h>
              signed main()
              {
                  double a, b;
              	std::cin >> a >> b;
              	std::printf("%.3lf%%", b * 100 / a);
              }
              
          • 1
            @ 2023-5-20 18:52:45

            T1003 甲流疫情死亡率

            参考代码:

            #include <iostream>//hetao3097453
            #include <iomanip>
            using namespace std;
            int main()
            {
            	double a,b;
            	cin >> a >> b;
            	cout << fixed << setprecision(3) << b / a * 100.0;
            	cout << "%";
            	return 0;
            }
            

            hetao3097453

            2023年5月20日

            • 0
              @ 2024-4-14 16:11:07
              #include <iostream>
              #include <iomanip>
              using namespace std;
              int main()
              {
                  double a,b,ans;
                  cin >> a;
                  cin >> b;
                  ans = double(b/a*100);
                  cout << fixed << setprecision(3) << ans << '%';
                  return 0;
              }
              //注意b/a要*100
              
              • 0
                @ 2024-3-31 12:45:43
                #include <bits/stdc++.h> //头文件
                using namespace std; //定义命名空间
                int main(){ //主函数
                    double a, b; //定义浮点数类型变量
                    cin >> a >> b; //输入
                    cout << fixed << setprecision(3) << b / a * 100 << "%"; //转化成百分数并输出小数点后3位
                    return 0;
                }
                
                • 0
                  @ 2023-8-9 17:12:42

                  题目描述

                  甲流并不可怕,在中国,它的死亡率并不是很高。请根据截止2009年12月22日各省报告的甲流确诊数a和死亡数b,计算甲流在各省的死亡率。

                  输入2行:第1行a,第2行b 输出1行:甲流死亡率,以百分数形式输出,精确到小数点后3位

                  注意事项

                  1. 小数形式的死亡率(b/a)
                  2. 转化为百分比的形式(*100)
                  3. 别忘了加上百分号(%),shift+5

                  AC代码

                  #include <bits/stdc++.h> 
                  using namespace std;
                  int main()
                  {
                      double a,b;
                      cin >> a;
                      cin >> b;
                      cout << fixed << setprecision(3) << b/a*100 << "%";
                      return 0;
                  }
                  
                  
                  • 0
                    @ 2023-6-10 14:11:16

                    甲流疫情死亡率

                    分析:死亡率=死亡数÷确诊数

                    下面,我们只需要根据公式·死亡率=死亡数÷确诊数来编写即可 重点:

                    cout << fixed << setprecision(3) << b / a * 100.0<<"%";
                    
                    • 0
                      @ 2023-5-21 16:06:24

                      题目分析

                      可以说,这算是一个数学百分比问题,主要求【死亡数】占【确诊数】的百分比。 可以理解为【确诊数】是总数,而【死亡数】是总数中的一部分。那么:

                      【死亡率】=【死亡数】÷【确诊数】

                      如何转为百分数?我们知道

                      1÷100=0.01,也表示1占了100的0.01,也就是1%。

                      其实就是把0.01×100,再加上一个百分号%,就等于1%,所以0.01=1%

                      同理50÷100=0.5,也等于50%

                      那么,在写代码时,把结果乘以100,再加一个百分号%即可。

                      注意!C++是没有百分数的写法。

                      #include<bits/stdc++.h>
                      using namespace std;
                      int main()
                      {
                          int a,b;
                          cin>>a>>b;
                          cout<<fixed<<setprecision(3);
                          cout<<100.0*b/a<<'%';
                          return 0;
                      }
                      
                      
                      
                      • @ 2023-6-10 14:00:49
                        #include <bits/stdc++.h>
                        int main()
                        {
                            double a, b;
                        	std::cin >> a >> b;
                        	std::printf("%.3lf%%", b * 100 / a);
                        	return 0;
                        }
                        
                    • 1

                    信息

                    ID
                    82
                    时间
                    1000ms
                    内存
                    128MiB
                    难度
                    4
                    标签
                    递交数
                    594
                    已通过
                    266
                    上传者