Tên đăng nhập Điểm Bài tập ▾ Giới thiệu
13801 2177 5
13802
Duchoclamcoder
Đào Lê Văn Đức
1780 5
13803 657 5
13804 2477 5
13805
ndnnhu_ek17
Nguyễn Đoàn Nguyệt Như-EK17
376 5
13806 457 5
13806 457 5
13808 453 5
13809 2507 5
13810 457 5
13810 457 5
13812 448 5
13813 5231 5
13814 414 5
13815 2071 5
13816 457 5
13817 1761 5
13818 807 5

no hope!

13819
truong2d1
Smilling
457 5
13820 847 5
13821 1555 5
13822
hslvtnb
Hoc Sinh
457 5
13823 6557 5
13824 2337 5
13825 2469 5
13826 1509 5

hello

13827 1289 5
13828 3411 5
13829
chitamha
Chí Tâm
2607 5
13830 457 5
13831 2039 5
13832 457 5
13833
nguyenanhquan135
Nguyen Anh Quan
4871 5
13834 457 5
13835 1961 5

include <iostream>

include <string>

using namespace std;

bool ktra( int b[] , int len , int k )
{
long dem=0,tong=0;
if (len==2){
if (b[0] ==0 || b[1]==0) return false;
}
for (int i=0;i<len;i++) { tong+=b[i]; if (tong>k) return false;
}
if (tong!=k) return false;
return true;
}

int main()
{
//freopen("SUBSTR.INP","r",stdin);
//freopen("SUBSTR.OUT","w",stdout);
long n,dem2=0;
string a;
cin>>n;
if (n==0) return 0;
cin>>a;
int b[a.length()];
for (int i=a.length()-1;i>=0;i--)
{
b[i]=a[i]-'0';
}
//xuly
if (ktra(b,a.length(),n)) dem2++;
for (int len=2;len<a.length();len++)
{
int c[len];
for (int i=0;i<a.length()-1 ;i++) { int temt2=len; while (temt2>0)
{
c[temt2-1]=b[i+temt2-1];
temt2--;
}
if (ktra(c,len,n)) dem2++;
}
}
cout<<dem2;
return 0;

}

13836 3078 5
13837 1409 5
13838 466 5
13839 2747 5
13840 1434 5
13841 2180 5
13842
nhuhuynhtruong 1707
Truong Huynh Nhu
6098 5

CLHS khong phai la 1 to chuc, CLHS la mot he tu tuong 🐧

13843 1451 5
13844 5695 5
13845
lop9a1ntb
dao nguyen trong nguyen
1115 5
13846 3174 5
13847 457 5
13848 1157 5
13848 1157 5
13850
socrusafter
Nguyen Hung Anh
965 5
13851 1822 5
13852 1704 5
13853 2124 5
13854 1339 5
13855 1316 5
13856 473 5
13857 828 5
13858 2963 5
13859 4052 5
13860 391 5
13861 1224 5
13862 3054 5
13863 327 5
13864 1878 5
13865 546 5
13866 2977 5
13867 457 5
13867 457 5
13869 1026 5
13870 3222 5
13871 933 5
13872 5554 5
13873 3338 5
13874 1432 5
13875 5431 5
13876 4726 5
13877 3312 5
13878
bassu
Hoshino
786 5

13879 5071 5
13880 457 5
13881 566 5
13881 566 5
13883 1257 5
13884 657 5
13884 657 5
13886 457 5
13887 1902 5
13888 1175 5
13889 2084 5
13890 1101 5
13891 1922 5
13892 1624 5

nothing here until now

13893 1827 5
13894 1199 5
13895 405 5
13896 457 5
13897 1252 5
13898 657 5
13899 719 5
13900 1337 5