4 solutions

  • 4
    @ 2024-7-10 15:16:39
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	char ch;
    	cin>>n>>ch;
    	int cost=8;
    	n=n-1000;
    	if(n>0) //说明有超重的部分
    	{
    		cost=cost+(n+500-1)/500*4;//累加超重的费用
    	}
    	if(ch=='y')
    	{
    		cost=cost+5;
    	}
    	cout<<cost;
    	return 0;
    }
    
    • 3
      @ 2025-3-12 20:17:36
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int a;
      	char b;
      	cin>>a>>b;
      	if(a<=1000)
      	{
      		if(b=='y')
      		{
      			cout<<13;
      		}
      		else
      		{
      			cout<<8;
      		}
      	}
      	else
      	{
      		int n=a-1000; 
      		if(n%500!=0)
      		{
      			int z;
                  if(b=='y')
      			{
      				 z=5;
      			}
      			else
      			{
      				 z=0;
      			}
      			int x=n/500;
      			cout<<8+(x+1)*4+z;
      		}
      		else
      		{
      			int z;
      			if(b=='y')
      			{
      				 z=5;
      			}
      			else
      			{
      				 z=0;
      			}
      			int x=n/500;
      			cout<<8+x*4+z;
      		}
      	}
      	return 0;
      }
      
      • 0
        @ 2025-7-10 11:05:09
        #include<bits/stdc++.h> 
        using namespace std;
        int main()
        {
            int n,s=8;
            char z;
            cin>>n>>z;
            if(n>1000)
            {
                if((n-1000)%500==0) s+=(n-1000)/500*4;
                else s+=(n-1000)/500*4+4;
            }
            if(z=='y') s+=5;
            cout<<s;
            return 0;
        }
        
        • 0
          @ 2025-3-19 19:43:04
          #include <bits/stdc++.h>
          using namespace std;
          int main()
          {
          	int w;
          	char ch;
          	cin>>w>>ch;
          	int c=8;
          	w=w-1000;
          	if(w>0)
          	{
          		int t=(w+500-1)/500;
          		c=c+t*4;
          	}
          	if(ch=='y')
          	{
          		c=c+5;
          	}
          	cout<<c;
          	return 0; 
          }
          
          • 1

          Information

          ID
          857
          Time
          1000ms
          Memory
          256MiB
          Difficulty
          3
          Tags
          (None)
          # Submissions
          460
          Accepted
          93
          Uploaded By