2588번: 곱셈


#include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
int B100 = B/100;
int B10 = B/10 - B100*10;
int B1 = B%10;
cout << A * B1 << endl;
cout << A * B10 << endl;
cout << A * B100 << endl;
cout << A * B << endl;
}
메모리 (KB) | 시간 (ms) | 코드 길이 (B) |
2020 | 0 | 274 |
➕ 재풀이
#include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
cout << A * (B%10) << endl;
cout << A * (B / 10 % 10) << endl;
cout << A * (B/100)<<endl;
cout << A * B << endl;
}
메모리 (KB) | 시간 (ms) | 코드 길이 (B) |
2020 | 0 | 218 |
더 깔끔하다.
Uploaded by N2T