File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 1+ #include < string>
2+ #include < cmath>
3+ #include < vector>
4+ #include < algorithm>
5+ using namespace std ;
6+
7+ int solution (int n) {
8+ int answer = 0 ;
9+ vector<int > three;
10+
11+ while (n){
12+ three.push_back (n % 3 );
13+ n /= 3 ;
14+ }
15+ reverse (three.begin (), three.end ());
16+
17+ for (int i = 0 ; i < three.size (); ++i)
18+ answer += pow (3 , i) * three[i];
19+
20+ return answer;
21+ }
Original file line number Diff line number Diff line change 2222 <ClCompile Include =" Lv1\Lv1_2016년.cpp" >
2323 <ExcludedFromBuild Condition =" '$(Configuration)|$(Platform)'=='Debug|x64'" >true</ExcludedFromBuild >
2424 </ClCompile >
25+ <ClCompile Include =" Lv1\Lv1_3진법뒤집기.cpp" >
26+ <ExcludedFromBuild Condition =" '$(Configuration)|$(Platform)'=='Debug|x64'" >true</ExcludedFromBuild >
27+ </ClCompile >
2528 <ClCompile Include =" Lv1\Lv1_K번째수.cpp" >
2629 <ExcludedFromBuild Condition =" '$(Configuration)|$(Platform)'=='Debug|x64'" >true</ExcludedFromBuild >
2730 </ClCompile >
Original file line number Diff line number Diff line change 504504 <ClCompile Include =" Lv1\Lv1_약수의개수와덧셈.cpp" >
505505 <Filter >소스 파일</Filter >
506506 </ClCompile >
507+ <ClCompile Include =" Lv1\Lv1_3진법뒤집기.cpp" >
508+ <Filter >소스 파일</Filter >
509+ </ClCompile >
507510 </ItemGroup >
508511</Project >
You can’t perform that action at this time.
0 commit comments