4 solutions

  • 2
    @ 2023-10-29 14:56:05
    #include<iostream>
    using namespace std;
    int main()
    {
     int n,mo=8;
     char m;
     cin>>n>>m;//输入
     if(m=='y') mo+=5;//加不加急
     if(n>1000)
     {
      n-=1000;//减掉基本的
      mo+=n/500*4;//整除500的价格
      if(n%500) mo+=4;//是否在500内
     }
     cout<<mo;//输出
     return 0;//完结散花!
    }
    
    • 1
      @ 2024-1-27 9:22:05
      #include<iostream>
      #include<iomanip>
      using namespace std;
      int p=8,w;
      char x;
      int main(){
      	
      	cin>>w>>x;
      	if(w>1000){
      		if(w%500==0) p+=(4*(w-1000)/500);
      		else p+=(4*((w-1000)/500+1));
      	}
      	if(x=='y') p+=5;
      	cout<<p<<"\n";
      }
      

      if嵌套

      • 1
        @ 2023-7-15 17:53:46

        练习c++两年半,志在让老师白吃干饭。 题库里题解不断,看名就知道是我在干。

        #include<bits/stdc++.h>
        using namespace std;
        int main()
        {
        int w,s = 8;
        string a;
        cin>>w>>a;
        if(w > 1000)
        {
        if(w % 500 == 0)
        {
        s+=(((w - 1000) / 500) * 4);
        }
        else
        {
        s+=(((w - 1000) / 500 + 1) * 4);
        }
        }
        if(a == "y") s += 5;
        cout<<s<<endl;
        }
        
      • 0
        @ 2023-9-17 11:09:36
        #include <bits/stdc++.h>
        using namespace std;
        int w,s=8;
        int main(){
        	string a;
        	cin>>w>>a;
        	if(w>1000){
        		if(!w%500) s+=((w-1000)/500)*4;
        		else s+=((w-1000)/500+1)*4;
        	}
        	if(a=="y") s+=5;
        	cout<<s<<endl;
        	return 0;
        }
        //简单的分类讨论而已
        //比楼下那位好点吧......
        
      • 1

      Information

      ID
      539
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      2
      Tags
      # Submissions
      59
      Accepted
      36
      Uploaded By