1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
#include <iostream> #include <cstdio> #include <queue> #include <sstream> #include <string> #include <vector> #include <cstring> #include <cmath> #define ll long long using namespace std; vector<ll> v; int main() { int t; ll n,sq,sq_root,x; int kase=1; scanf("%d",&t); while(t--) { scanf("%lld",&n); sq=0; int k=0; v.clear(); for(ll i=0;;i++) { sq += 2*i+1; sq_root=i+1; if(sq>=n) break; x = n-sq; if(x%sq_root==0 && x!=0) v.push_back(x); } printf("Case %d:",kase++); for(int i=v.size()-1;i>=0;i--) printf(" %lld",v[i]); printf("\n"); } return 0; } |