Pagini recente » Cod sursa (job #1453102) | Cod sursa (job #2707755) | Cod sursa (job #348305) | Cod sursa (job #184223) | Cod sursa (job #2262518)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("interzis.in");
ofstream fout("interzis.out");
int n,m,a[15000];
int mod=101267;
void citire()
{
fin>>m>>n;
}
int ridik()
{
int c=2%mod;
int k=1,pow=1;
int rez=c;
while(pow < m)
{
if(pow + k <= m)
{
rez = (rez * c) % mod;
pow = pow + k;
k = k * 2; c = (c * c)%mod;
}
else k = 1, c = 2 % mod;
}
cout<<rez;
return rez;
}
void rez()
{ a[1]=1;
for(int i=2; i<=m; i++)
{
a[i]=(2*a[i-1])%mod;
}
int sol=0;
for(int j=2; j<=m-n+1; j++)
{
sol+=((a[j])%mod);
}
fout<<ridik()-sol-1;
}
int main()
{
citire();
rez();
return 0;
}