5 条题解

  • 0
    @ 2025-8-8 10:40:43

    又双叒叕是一道水题

    直接看代码吧:

    #include<iostream>
    #include<cmath>
    #define QwQ return 0;
    using namespace std;
    double n;
    int main(){
    	cin>>n;
    	n=ceil(n);
    	cout<<(n<=5?12:12+(n-5)*2);
    	QwQ
    }
    
    • 0
      @ 2024-12-29 10:46:17
      #include<bits/stdc++.h>
      #define int double
      using namespace std;
      signed main(){
      	int n;
      	cin>>n;
      	n=ceil(n);
      	if(n<=5)cout<<12;
      	else cout<<12+(n-5)*2;
      }
      
      • 0
        @ 2024-12-29 8:34:56

        别忘了要向上取整。

        #include<bits/stdc++.h>
        //#define int long long
        #define INF 0x3f3f3f
        using namespace std;
        double x;
        signed main(){
        	cin>>x;
        	if(x!=int(x))x=int(x)+1;
        	if(x<=5)cout<<"12";
        	else cout<<12+(x-5)*2;
        	return 0;
        }
        
        • 0
          @ 2024-12-28 22:48:47

          玩把大的:不用 if

          #include<bits/stdc++.h>
          using namespace std;
          int main()
          {
          	double x;
          	cin>>x;
          	x=ceil(x);
          	int a=12+(x-5)*2;
          	cout<<a;
          	return 0;
          }
          
          • @ 2024-12-28 22:49:11

            woc,啊?写的比官解还短?!

        • 0
          @ 2024-12-22 11:03:54

          C++ :

          #include <bits/stdc++.h>
          using namespace std;
          int main() {
          	double x;
          	cin >> x;
          	int b = (int)(x - 5.0);
          	if (x <= 5) {
          		cout<<"12";
          	}
          	else {
          		int ans = 0;
          		if (b < x) {
          			ans = 12 + (b+1)*2;
          		}
          		else {
          			ans = 12 + b * 2;
          		}
          		if (ans == 24) ans = 22;
          		cout<<ans;
          	}
          	return 0;
          }
          

          Python :

          # coding=utf-8
          a=float(input())
          s=0
          if a<=5:
              s=12
          else:
              if a%1==0:
                  s=12+(a//1-5)*2
              else:
                  s=12+(a//1-4)*2
          print(int(s))
          
          • 1

          信息

          ID
          39
          时间
          1000ms
          内存
          128MiB
          难度
          1
          标签
          (无)
          递交数
          34
          已通过
          28
          上传者