4 条题解

  • 1
    @ 2024-12-28 15:20:57

    题目直接把我整蒙了。

    #include<bits/stdc++.h>
    #define int long long
    #define INF 0x3f3f3f
    using namespace std;
    int x,zero;
    char c;
    signed main(){
    	cin>>x>>c;
    	int ans;
    	if(x<=1000){
    		if(c=='n')cout<<"8";
    		else cout<<"13";
    		return 0;
    	}
    	if(x%500)ans=((x-1000)/500+1)*4+8;
    	else ans=((x-1000)/500)*4+8;
    	if(c=='y')ans+=5;
    	cout<<ans;
    	return 0;
    }
    
    • 0
      @ 2024-12-28 11:47:38
      #include<bits/stdc++.h>
      using namespace std;
      int main(){
          int m,n;
      	char c;
      	cin>>m>>c;
      	if(m>1000)n=8+ceil((m-1000)/500.0)*4;
      	else n=8;
      	if(c=='y')n=n+5;
      	cout<<n<<endl; 
      	return 0; 
      }
      
      • 0
        @ 2024-12-24 21:14:03

        分段计费+是否加急。

        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        	int n,k=8;
        	char a;
        	cin>>n>>a;
        	if(a=='y')
        		k+=5;
        	if(n>1000)
        	{
        		n=n-1000;
        		k+=n/500*4;
        		if(n%500!=0)
        		{
        			k+=4;
        		}
        	}
        	cout<<k;
        	return 0;
        }
        
        • 0
          @ 2024-12-22 11:03:53

          C++ :

          #include<bits/stdc++.h>
          using namespace std;
          int main(){
          	int a,c,d,e;
          	char b;
          	cin>>a>>b;
          	if(a<=1000&&b=='y'){
          		c=8+5;
          		cout<<c;
          	}
          	else if(a<=1000&&b=='n'){
          		c=8;
          		cout<<c;
          	}
          	else if(a>1000&&b=='n'){
          		d=(a-1000)/500;
          		e=(a-1000)%500;
          		if(e!=0){
          			d+=1;
          		}
          		c=d*4+8;
          		cout<<c;
          	}
          	else{
          		d=(a-1000)/500;
          		e=(a-1000)%500;
          		if(e!=0){
          			d+=1;
          		}
          		c=d*4+8+5;
          		cout<<c;
          	}
          }
          

          Python :

          # coding=utf-8
          x,y=input().split()
          x=int(x)
          s=0
          if x<=1000:
              s=8
          else:
              if (x-1000)%500==0:
                  s=8+(x-1000)//500*4
              else:
                  s=8+(x-1000)//500*4+4
          if y=='y':
              s=s+5
          print(s)
          
          • 1

          信息

          ID
          20
          时间
          1000ms
          内存
          128MiB
          难度
          3
          标签
          (无)
          递交数
          43
          已通过
          25
          上传者