반응형 개인공부40 SW Expert Academy(2063. 중간값 찾기) C++ #include #include using namespace std; int main(int argc, char** argv) { int test_case; int T; int a[199]; cin>>T; for(test_case = 0; test_case > a[test_case]; } sort(a, a+199); printf("%d", a[T/2]); return 0;//정상종료시 반드시 0을 리턴해야합니다. } 2021. 8. 10. SW Expert Academy(2068. 최대수 구하기) C++ #include using namespace std; int main(int argc, char** argv) { int test_case; int T; int a[10]; int max; cin>>T; for(test_case = 1; test_case a[k]; if(a[k] > max) max = a[k]; } printf("#%d %d\n", test_case, max); } return 0;//정상종료시 반드시 0을 리턴해야합니다. } 2021. 8. 10. SW Expert Academy (2070. 큰 놈, 작은 놈, 같은 놈)C++ #include #include using namespace std; int main(int argc, char** argv) { int test_case; int T; int a, b; cin>>T; for(test_case = 1; test_case b) printf("#%d >\n", test_case); else if( a == b) printf("#%d =\n", test_case); else printf("#%d 2021. 8. 9. C++ iomanip 헤더, 소수점 자리 출력 fixed #include 를 포함시키면 setprecision(자리수)를 사용할 수 있다. 또한 fixed를 사용하여 원하고자 하는 자리수 까지 출력할 수 있다. #include #include using namespace std; int main(){ double a = 1.8888888888; //소수점 3번째 자리에서 반올림 cout 2021. 7. 2. 이전 1 2 3 4 5 6 ··· 10 다음 반응형