1 static int wing=[]()
 2 {
 3     std::ios::sync_with_stdio(false);
 4     cin.tie(NULL);
 5     return 0;
 6 }();
 7 
 8 class Solution 
 9 {
10 public:
11     string convertToBase7(int num) 
12     {
13         if(num==0)
14             return "0";
15         string res;
16         int k=abs(num);
17         int remain=0;
18         while(k)
19         {
20             remain=k%7;
21             res.push_back(remain+'0');
22             k/=7;
23         }
24         if(num<0)
25             res.push_back('-');
26         reverse(res.begin(),res.end());
27         return res;
28     }
29 };

 转7进制,余除,问题不大

posted on 2018-06-03 16:17  高数考了59  阅读(101)  评论(0)    收藏  举报