2 solutions

  • 2
    @ 2025-9-23 12:28:11
    #include <bits/stdc++.h>
    using namespace std;
    long long n;
    int main()
    {
    	cin >> n;
    	if (n % 2 == 0)
    	{
    		cout << n / 2;
    	}
    	else
    	{
    		cout << n / 2 + 1;
    	}
    	return 0;
    }
    
    • 1
      @ 2025-9-23 17:58:32

      #include<bits/stdc++.h> using namespace std; int main(){ freopen("print.in","r",stdin); freopen("print.out","w",stdout); int n; cin>>n; if(n%2==0) cout<<n/2;//双数直接除二输出。 else cout<<n/2+1;//奇数加1除2输出。 return 0; }

      • 1

      Information

      ID
      1065
      Time
      1000ms
      Memory
      256MiB
      Difficulty
      6
      Tags
      # Submissions
      30
      Accepted
      11
      Uploaded By