3 条题解

  • 0
    @ 2023-7-8 15:31:54
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	int n;
    	cin>>n;
    	int ans=0;
    	while(n>0){
    		ans+=n%10;
    		n/=10;
    	}
    	cout<<ans;
    	return 0;
    }
    

    while不会用吗

    • 0
      @ 2023-3-20 19:24:09

      #include<bits/stdc++.h> using namespace std; int main() { int s,ge,shi,bai,qian; cin>>s; ge=s%10; shi=s%100/10; bai=s/100%10; qian=s/1000; cout<<ge+shi+bai+qian; return 0; }

      • -2
        @ 2022-11-12 11:17:08
        #include<iostream>
        using namespace std;
        int main()
        {
        int x;
        cin>>x;
        cout<<x-x/1000-x%1000/100*10-x%1000%100/10*100-x%1000%100%10*1000;
        }
        
        • @ 2023-3-20 19:24:00

          乱写!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

        • @ 2023-3-20 19:24:40

          看我的!

      • 1

      信息

      ID
      387
      时间
      1000ms
      内存
      16MiB
      难度
      1
      标签
      递交数
      38
      已通过
      31
      上传者