T1 run
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5;
int a[maxn];
int n,m,k;
int now;
int ans;
int main()
{
freopen("run.in","r",stdin);
freopen("run.out","w",stdout);
cin>>n>>m>>k;
for(int i=1;i<=k;i++)
{
int opt;
cin>>opt;
a[opt]=1;
}
while(now<n)
{
ans++;
now+=m;
if(a[now]==1)
m++;
}
cout<<ans<<endl;
return 0;
}
T2 number
#include<bits/stdc++.h>
using namespace std;
int ans;
long long l, r;
int main()
{
freopen("number.in", "r", stdin);
freopen("number.out", "w", stdout);
cin >> l >> r;
l = l % 9;
r = r % 9;
if (r < l)
r += 9;
for (long long j = l; j <= r; j++)
{
ans += j;
ans = ans % 9;
}
cout << ans << endl;
return 0;
}
T3 hair
#include<bits/stdc++.h>
using namespace std;
int n,x,a,ans,last;
int main()
{
freopen("hair.in","r",stdin);
freopen("hair.out","w",stdout);
cin>>n>>x;
for(int i=1;i<=n;i++)
{
cin>>a;
if(i==1)
{
if(a>x)
{
ans+=a-x;
a=x;
}
}
else
{
if(last+a>x)
{
ans += (last + a) - x;
ans%=998244353;
a -= ((last + a) - x);
}
}
last=a;
}
cout<<ans<<endl;
return 0;
}
T4 station
#include<bits/stdc++.h>
using namespace std;
int n;
int a[205][205];
int f[205];
int main()
{
freopen("station.in","r",stdin);
freopen("station.out","w",stdout);
cin>>n;
for(int i=1;i<=n;i++)
{
for(int j=i+1;j<=n;j++)
{
cin>>a[i][j];
}
}
memset(f,0x3f,sizeof f);
f[n]=0;
for(int i=n;i>=1;i--)
{
for(int j=i+1;j<=n;j++)
{
f[i]=min(f[i],f[j]+a[i][j]);
}
}
cout<<f[1]<<endl;
return 0;
}