15 条题解

  • 10
    @ 2024-7-14 18:06:39

    题目分析:

    由题目,我们可知题目要求的情况就是资源增长量等于消耗量,题目可转换为:

    设时间为 tt,每年的资源增长可以养活 kk 人,原有资源量为 W0W_0,总资源量为WW,在 WW 关于 tt 的函数 W=kt+W0W=kt+W_0 上有两点 (a,ax)(a,ax)(b,by)(b,by) ,求 kk 的值。

    此时只需要利用公式 k=xyk=\dfrac {\vartriangle x} {\vartriangle y} 即可求解。

    注意: 答案要求取小数点后两位,因此输出时采用 printf() 函数的 "%.2lf"

    代码实现:

    #include<cstdio>
    int main( ){
        int a,x,b,y;
        scanf("%d%d%d%d",&x,&a,&y,&b);
        printf("%.2lf\n",1.0*(b*y-a*x)/(b-a));
        return 0 ;
    }
    

    记得给五星好评哦喵~ 谢谢客官啦~

    • 0
      @ 2024-2-23 8:23:06
      #include<iostream>
      using namespace std;
      #include<iomanip>
       
      int main()
      {
      	int x, a, y, b;
      	cin >> x >> a >> y >> b;
      	cout << fixed << setprecision
      
      • 0
        @ 2024-2-23 8:23:01
        #include<iostream>
        using namespace std;
        #include<iomanip>
         
        int main()
        {
        	int x, a, y, b;
        	cin >> x >> a >> y >> b;
        	cout << fixed << setprecision
        
        • 0
          @ 2024-2-22 22:00:58

          原有资源为total,每年新增资源为new,每亿人每年消耗为eat,则有

          (1)total+a* new=a* x* eat

          (2)total+b* new=b* y* eat

          式(2)-式(1)得:

          new*(b-a)=(b* y-a* x)* eat

          得出new/eat=(b* y-a* x)/(b-a)

          若要地球资源持续养活z亿人,则不能消耗原有资源,每年新增资源刚好够z亿人消耗,则:

          z*eat=new,推出

          z=new/eat=(b* y-a* x)/(b-a)

          • -1
            @ 2025-2-13 11:43:25

            #include int main( ){ int a,x,b,y; scanf("%d%d%d%d",&x,&a,&y,&b); printf("%.2lf\n",1.0*(by-ax)/(b-a)); return 0 ; }

            • -1
              @ 2024-2-23 8:23:01
              #include<iostream>
              using namespace std;
              #include<iomanip>
               
              int main()
              {
              	int x, a, y, b;
              	cin >> x >> a >> y >> b;
              	cout << fixed << setprecision
              
              • -2
                @ 2024-2-23 10:00:49

                #include using namespace std; #include

                int main() { int x, a, y, b; cin >> x >> a >> y >> b; cout << fixed << setprecision(2) << 1.0 * (b * y - a * x) / (b - a); }

                • -2
                  @ 2024-2-23 10:00:40

                  #include using namespace std; #include

                  int main() { int x, a, y, b; cin >> x >> a >> y >> b; cout << fixed << setprecision(2) << 1.0 * (b * y - a * x) / (b - a); }

                  • -2
                    @ 2024-2-23 10:00:12

                    #include using namespace std; #include

                    int main() { int x, a, y, b; cin >> x >> a >> y >> b; cout << fixed << setprecision(2) << 1.0 * (b * y - a * x) / (b - a); }

                    • -3
                      @ 2024-2-23 8:22:47
                      #include<iostream>
                      using namespace std;
                      #include<iomanip>
                       
                      int main()
                      {
                      	int x, a, y, b;
                      	cin >> x >> a >> y >> b;
                      	cout << fixed << setprecision
                      
                      • -3
                        @ 2024-2-22 19:27:30
                        #include<iostream>
                        using namespace std;
                        #include<iomanip>
                         
                        int main()
                        {	double x, a, y, b;
                        	cin >> x >> a >> y >> b;
                        printf("%.2lf",(1.0*(b*y-a*x)/(b-a)));
                        return 0;}
                        
                        
                        • -3
                          @ 2024-2-22 11:26:52
                          #include<iostream>
                          using namespace std;
                          #include<iomanip>
                           
                          int main()
                          {
                          	int x, a, y, b;
                          	cin >> x >> a >> y >> b;
                          	cout << fixed << setprecision(2) << 1.0 * (b * y - a * x) / (b - a);
                          }
                          
                          • -4
                            @ 2024-2-23 8:23:01
                            #include<iostream>
                            using namespace std;
                            #include<iomanip>
                             
                            int main()
                            {
                            	int x, a, y, b;
                            	cin >> x >> a >> y >> b;
                            	cout << fixed << setprecision
                            
                            • -4
                              @ 2024-2-23 8:22:55
                              #include<iostream>
                              using namespace std;
                              #include<iomanip>
                               
                              int main()
                              {
                              	int x, a, y, b;
                              	cin >> x >> a >> y >> b;
                              	cout << fixed << setprecision
                              
                              • -5
                                @ 2024-2-23 8:23:07
                                #include<iostream>
                                using namespace std;
                                #include<iomanip>
                                 
                                int main()
                                {
                                	int x, a, y, b;
                                	cin >> x >> a >> y >> b;
                                	cout << fixed << setprecision
                                
                                • 1

                                信息

                                ID
                                56
                                时间
                                1000ms
                                内存
                                128MiB
                                难度
                                2
                                标签
                                (无)
                                递交数
                                343
                                已通过
                                208
                                上传者