4 solutions

  • 3
    @ 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;
    }
    
    • 2
      @ 2025-3-22 10:47:10
      #include<bits/stdc++.h>
      using namespace std;
      int main()
      {
      	int n;
      	char m;
      	cin>>n>>m;
      	int c=0;
      	n=n-1000;
      	if(n>0)
      	{
      		c=8+(n+500-1)/500*4;
      	}
      	else
      	{
      		c=8;
      	}
      	if(m=='y')
      	{
      		c=c+5;
      	}
      	cout<<c;
      	return 0;
      }
      
      • 2
        @ 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;
        }
        
        • 1
          @ 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
          370
          Accepted
          77
          Uploaded By