52分 求助

P1480 A/B Problem

ptxy2352010111 @ 2024-09-22 21:33:29

#include<bits/stdc++.h>
using namespace std;
string a;
long long b,h;
string s;
int main(){
    cin>>a>>b;
    bool flag=0;
    if(a[0]=='0'){
        cout<<0;
        return 0;
    }
    for(int i=0;i<a.size();i++){
        h=h*10+(a[i]-'0');
        int w=0;
        for(int i=1;i<=9;i++){
            if(i*b>h){
                w=i-1;
                break;
            }
        }
        if(w!=0){
            flag=1;
            s=s+char(w+'0');
        }else if(flag==1){
            s=s+'0';
        }
        h=h-w*b;
    }
    cout<<s;
    return 0;
} 

by 2811david @ 2024-10-27 11:13:48

#include<bits/stdc++.h>
using namespace std;
int main(){
    unsigned long long a,b;
    cin>>a>>b;
    cout<<a/b;
    return 0;
}

by 2811david @ 2024-10-27 11:15:07

十分简单(52分)


|