Bạn muốn chia sẻ đề thi hửm?
Bài 2:
2:
#include <bits/stdc++.h>
using namespace std;
string n;
int t,d,i;
int main()
{
freopen("tinhtong.inp","r",stdin);
freopen("tinhtong.out","w",stdout);
cin>>n;
cin>>m;
d=n.length();
t=0;
for (i=d-m-1; i<=d-1; i++)
t=t+int(n[i])-48;
cout<<t;
return 0;
}