1 条题解

  • 0
    @ 2021-6-15 12:56:53

    C++ :

    #include<iostream>
    using namespace std;
    int main()
    {
    	int n,day=0;
    	cin>>n;
    	n*=1000;
    	while (n>0)
    	{
    		n+=50;
    		n-=3000;
    		day++;
    	}
    	cout<<day<<endl;
    	return 0;
    }
    

    Java :

    import java.util.Scanner;
    
    public class Main {
    
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		Scanner input=new Scanner(System.in);
    		int n=input.nextInt();
    		int count=0;
    		int sum=50;
    		if(n%3==0) {
    			count=n/3;
    			sum*=count;
    		}else {
    			count=n/3+1;
    			sum*=count;
    		}
    		if(sum>3000) {
    		 if(sum%3000==0) {
    			 count++;
    		 }else {
    			 sum=sum/3000;
    			 count+=sum;
    		 }
    		}else {
    			count++;
    		}
    		System.out.println(count);
    	}
    }
    
    
    • 1

    信息

    ID
    729
    时间
    1000ms
    内存
    128MiB
    难度
    10
    标签
    递交数
    1
    已通过
    1
    上传者