시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 256 MB96683627303337.917%

문제

A×B를 계산하다 지겨워진 형택이는 A×B를 새로운 방법으로 정의하려고 한다.

A에서 한 자리를 뽑고 × B에서 임의로 한 자리를 뽑아 곱한다.

의 가능한 모든 조합 (A가 n자리, B가 m자리 수라면 총 가능한 조합은 n×m개)을 더한 수로 정의하려고 한다.

예를 들어 121×34는

1×3 + 1×4 + 2×3 + 2×4 + 1×3 + 1×4 = 28

이 된다. 이러한 형택이의 곱셈 결과를 구하는 프로그램을 작성하시오.

입력

첫째 줄에 A와 B가 주어진다. 주어지는 두 수는 모두 10,000자리를 넘지 않는 음이 아닌 정수이다. 수가 0인 경우에는 0만 주어지며, 그 외의 경우 수는 0으로 시작하지 않는다.

출력

첫째 줄에 형택이의 곱셈 결과를 출력한다.

예제 입력 1

123 45

예제 출력 1

54
W3sicHJvYmxlbV9pZCI6IjEyMjUiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWM3NzRcdWMwYzFcdWQ1NWMgXHVhY2YxXHVjMTQ4IiwiZGVzY3JpcHRpb24iOiI8cD5BJnRpbWVzO0JcdWI5N2MgXHVhY2M0XHVjMGIwXHVkNTU4XHViMmU0IFx1YzljMFx1YWNhOFx1YzZjY1x1YzljNCBcdWQ2MTVcdWQwZGRcdWM3NzRcdWIyOTQgQSZ0aW1lcztCXHViOTdjIFx1YzBjOFx1Yjg1Y1x1YzZiNCBcdWJjMjlcdWJjOTVcdWM3M2NcdWI4NWMgXHVjODE1XHVjNzU4XHVkNTU4XHViODI0XHVhY2UwIFx1ZDU1Y1x1YjJlNC48XC9wPlxyXG5cclxuPHA+QVx1YzVkMFx1YzExYyBcdWQ1NWMgXHVjNzkwXHViOWFjXHViOTdjIFx1YmY1MVx1YWNlMCAmdGltZXM7IEJcdWM1ZDBcdWMxMWMgXHVjNzg0XHVjNzU4XHViODVjIFx1ZDU1YyBcdWM3OTBcdWI5YWNcdWI5N2MgXHViZjUxX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GFpcndpc2UgcHJvZHVjdHMgYmV0d2VlbiB0aGUgZGlnaXRzIG9mIEEgYW5kIEIuIEZvciBleGFtcGxlLCB0aGUgcHJvZHVjdCAxMjMqNDUgaXMgZXF1YWwgdG8gMSo0ICsgMSo1ICsgMio0ICsgMio1ICsgMyo0ICsgMyo1ID0gNTQuICZuYnNwO0dpdmVuIHR3byBpbnRlZ2VycyBBIGFuZCBCLCBkZXRlcm1pbmUgQSpCIGluIEJlc3NpZSYjMzk7cyBzdHlsZSBvZiBtdWx0aXBsaWNhdGlvbi48XC9wPlxyXG4iLCJpbnB1dCI6Ijx1bD5cclxuXHQ8bGk+TGluZSAxOiBUd28gc3BhY2Utc2VwYXJhdGVkIGludGVnZXJzOiBBIGFuZCBCLiBMZW5ndGggb2YgQSBhbmQgQiBkbyBub3QgZXhjZWVkIDEwLDAwMC48XC9saT5cclxuPFwvdWw+XHJcbiIsIm91dHB1dCI6Ijx1bD5cclxuXHQ8bGk+TGluZSAxOiBBIHNpbmdsZSBsaW5lIHRoYXQgaXMgdGhlIEEqQiBpbiBCZXNzaWUmIzM5O3Mgc3R5bGUgb2YgbXVsdGlwbGljYXRpb24uPFwvbGk+XHJcbjxcL3VsPlxyXG4iLCJoaW50IjoiIiwib3JpZ2luYWwiOiIxIiwiaHRtbF90aXRsZSI6IjAiLCJwcm9ibGVtX2xhbmdfdGNvZGUiOiJFbmdsaXNoIn1d

출처

Olympiad > USA Computing Olympiad > 2007-2008 Season > USACO February 2008 Contest > Bronze 3번

  • 문제를 번역한 사람: author5