Parcourir la source

添加 'B.cpp'

meng il y a 5 ans
Parent
commit
93367b5fee
1 fichiers modifiés avec 21 ajouts et 0 suppressions
  1. 21 0
      B.cpp

+ 21 - 0
B.cpp

@@ -0,0 +1,21 @@
+#include<bits/stdc++.h>
+using namespace std;
+int main()
+{
+    int st,ed,t,temp;
+    cin>>st>>ed;
+    int a[10]={0};
+    for(int i=st;i<=ed;i++){
+        t=i;
+        while(t){
+            temp=t%10;
+            a[temp]++;
+            t/=10;
+        }
+    }
+    cout<<a[0];
+    for(int i=1;i<=9;i++){
+        cout<<" "<<a[i];
+    }
+    return 0;
+}