3 solutions

  • 1
    @ 2026-2-23 12:08:38
    #include<bits/stdc++.h>
    using namespace std;
    int main() {
        int x, y, n, p;
        cin >> x >> y >> n >> p;
    double a, b; 
        if (p >= x) {
            a = p - y;
        } else {
            a = p; 
        }
        b = p * n / 10.0; 
        cout << fixed << setprecision(2) << min(a, b);
    return 0;
    }
    
    
    • -1
      @ 2026-1-25 20:32:44
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
          double x,y,n,p;
          cin>>x>>y>>n>>p;
          if(p-double(int(p)/int(x)*y)<p*(n/10))printf("%.2f",p-double(int(p)/int(x)*y));
          else printf("%.2f",p*(n/10));
      }
      
      • -2
        @ 2025-11-27 11:54:18

        C++ :

        #include <algorithm>
        #include <cstdio>
        using namespace std;
        	int x, y, n, p;
        	double a1, a2;
        	int main() {
        	scanf("%d%d%d%d", &x, &y, &n, &p);
        	a1 = p;
        	if (a1 >= x) a1 -= y;
        	a2 = p * 0.1 * n;
        	printf("%.2lf\n", min(a1, a2));
        	return 0;
        }
        
        • 1

        Information

        ID
        25
        Time
        1000ms
        Memory
        128MiB
        Difficulty
        7
        Tags
        # Submissions
        41
        Accepted
        10
        Uploaded By