观察发现智数每过7个增加30。{3,5,9,15,21,25,27}是增加的类循环
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int d[]={0,3,5,9,15,21,25};
int t;
cin>>t;
while(t--){
long long k;
cin>>k;
long long res;
if(k%7)res=(k/7)*30+d[k%7];
else res=(k/7)*30-3;
cout<<res<<"\n";
}
return 0;
}

京公网安备 11010502036488号