1 条题解

  • 0
    @ 2024-12-24 9:14:28

    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
    433
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    (无)
    递交数
    2
    已通过
    2
    上传者