12 条题解

  • -2
    @ 2023-10-29 20:26:16
    #include <bits/stdc++.h>
    using namespace std;
    #define LL long long
    const int N = 1e5 + 10;
    const int INF = 0x3f3f3f3f;
    int x[N];
    int c[N];
    int main()
    {
    	string a;
    	LL y;
    	cin >> a >> y;
    	int lena = a.size();
    	for(int i = 0 ; i < lena ; i++)
    		x[i] = a[i] - '0';
    	LL len = 0;
    	LL ans = 0;
    	for(int i = 0 ; i< lena ; i++)
    	{
    		int f = 0;
    		ans = ans * 10 + x[i];
    		if(ans >= y)
    		{
    			f = ans/y;
    			ans = ans % y;
    		}
    		c[len++] = f;
    	}
    	LL num = 0;
    	while(c[num] == 0 && num < len)
    		num++;
    	if(num >= len)
    	{
    		cout << "0";
    		return 0;
    	}
    	for(int i = num ; i < len ; i++)
    		cout << c[i];
    	return 0;
    }
    

信息

ID
1189
时间
1000ms
内存
128MiB
难度
5
标签
递交数
395
已通过
139
上传者