You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <bits/stdc++.h>
using namespace std ;
typedef long long LL ;
/**
* 注意: 用例: 9000000000 1000000000
* 此时, 因为涉及到乘法计算, 使用int会爆掉, 在洛谷提交会最后一个点无法通过, 全部使用LL后可以正常通过测试点。
*/
using namespace std ;
/**
* 功能:高精度除法模板(高精除低精)
* @param A
* @param b
* @param r
* @return
*/
vector < LL > div ( vector < LL > & A , LL b , LL & r ) {
vector < LL > C ;
r = 0 ;
for ( int i = A . size ( ) - 1 ; i > = 0 ; i - - ) {
r = r * 10 + A [ i ] ;
C . push_back ( r / b ) ;
r % = b ;
}
reverse ( C . begin ( ) , C . end ( ) ) ;
while ( C . size ( ) > 1 & & C . back ( ) = = 0 ) C . pop_back ( ) ;
return C ;
}
int main ( ) {
string a ;
LL b , r ;
cin > > a > > b ;
vector < LL > A , C ;
for ( int i = a . size ( ) - 1 ; i > = 0 ; i - - ) A . push_back ( a [ i ] - ' 0 ' ) ;
C = div ( A , b , r ) ;
for ( int i = C . size ( ) - 1 ; i > = 0 ; i - - ) printf ( " %d " , C [ i ] ) ;
// printf("\n%d", r);
return 0 ;
}