1 条题解
-
0Infinity_ LV 8 @ 2024-08-30 11:24:45
#include<iostream> using namespace std; bool a[10] = {0, 0, 0, 0, 0, 0, 0, 1, 0, 0}; int main(){ ios::sync_with_stdio(false); int n, ii = 0; cin >> n; if(n < 0){ a[7] = 0; n = (-1)*n; } n--; while(n != 0){ a[ii++] = (n & 1); n = n >> 1; } for(int i = 0; i <= 7; i++){ if(!a[i]){ cout << i; return 0; } } return 0; }
- 1