7 条题解

  • 5
    @ 2022-1-17 22:45:02
    #include <iostream>
    using namespace std;
    int main(){
        double x,y;
        int n,a;
        cin>>x>>y>>n;
        a=(n*x)/y;
        cout<<a<<endl;
        return 0;
    }
    
    • 1
      @ 2023-8-7 19:56:08
      #include<bits/stdc++.h>
      #include<cstring>
      #include<queue>
      #include<set>
      #include<stack>
      #include<vector>
      #include<map>
      #define ll long long
      using namespace std;
      const int N=1e5+10;
      const int M=2023;
      const int inf=0x3f3f3f3f;
      double x,y,n;
      int main()
      {
      	cin>>x>>y>>n;
      	cout<<floor(x*n/y);
      	return 0;
      }
      
      

      要向下取整

      • 1
        @ 2023-6-25 13:32:07
        #include <iostream>
        #include <stdio.h>
        #include <iomanip>
        #include <math.h>
        using namespace std;
        const int N = 1e6 + 10;
        const int INF = 0x3f3f3f3f;
        int main()
        {
        	float x , y;
        	int n;
        	cin >> x >> y >> n;
        	n = (x * n) / y;
        	cout << n;
        	return 0;
        }
        
        • 0
          @ 2023-9-26 22:25:22
          • 0
            @ 2022-11-6 12:51:06
            #include <bits/stdc++.h>
            
            using namespace std;
            
            int main()
            {
                double x, y;
                long n;
            
                cin >> x >> y >> n;
            
                long long m = x * n / y;
            
                cout << m;
            
                return 0;
            }
            
            • -1
              @ 2023-3-4 18:32:17

              P824 做衣服

              image

              这里有一个误区,setprecision(0)并不是直接舍去小数部分,而是四舍五入至个位,所以可以直接在实数结果前强转成int

              蒟蒻のAC代码

              #include<bits/stdc++.h>
              using namespace std;
              int main(){
                  double x,y;
                  int n;
                  cin>>x>>y>>n;
                  cout<<(int)(x*n/y);
              }
              
              • -1
                @ 2023-1-2 14:38:55
                #include
                using namespace std;
                int main(){
                    double x,y;
                    int n,m;
                	cin>>x>>y;
                	cin>>n;
                	m=x*n/y;
                    cout<<m;
                }
                
                • 1

                信息

                ID
                824
                时间
                1000ms
                内存
                128MiB
                难度
                5
                标签
                递交数
                684
                已通过
                285
                上传者