Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions 1016A.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//The_Shellkore_Awakens
#include <bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
int main()
{
ll n,m,val;
cin>>n>>m;
ll sum=0;
for(int i=0;i<n;i++)
{
cin>>val;
sum+=val;
cout<<sum/m<<' ';
sum=sum%m;
}
return 0;
}
//1_5_3_7_6_9_1_1_P
43 changes: 43 additions & 0 deletions 1016B.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//The_Shellkore_Awakens
#include <bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
int main()
{
int n,m,q;
cin>>n>>m>>q;
string s,t;
cin>>s>>t;
int h[n]={0};
for(int i=0;i<=n-m;i++)
{int c=0;
for(int j=0;j<m;j++)
{
if(s[i+j]==t[j])
c++;
}
if(c==m)
{
h[i]=1;
h[i+m-1]=2;
}
}
while(q--)
{bool f=0;
int l,r,ans=0;
cin>>l>>r;
for(int i=l-1;i<r;i++)
{
if(h[i]==1)
f=1;
if(h[i]==2&&f==1)
{
f=0;ans++;
}
}
cout<<ans<<endl;
}
return 0;
}
//1_5_3_7_6_9_1_1_P
26 changes: 26 additions & 0 deletions 1017.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//The_Shellkore_Awakens
#include <bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
int main()
{
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++)
{int w,x,y,z;
cin>>w>>x>>y>>z;
a[i]=w+x+y+z;
}
int thomas=a[0];
sort(a,a+n,greater<int>());
for(int i=0;i<n;i++)
{
if(a[i]==thomas)
{cout<<i+1;
return 0;}
}
return 0;
}
//1_5_3_7_6_9_1_1_P
71 changes: 34 additions & 37 deletions 1023A.cpp
Original file line number Diff line number Diff line change
@@ -1,42 +1,39 @@
#include<bits/stdc++.h>
//The_Shellkore_Awakens
#include <bits/stdc++.h>
using namespace std;
#define fast() ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL)
typedef long long ll;
const int N = 1<<20;
vector<int>v;
ll cnt,a[N],b[N],has[N],n,m,sum;
bool flag,f;
int main()
{
ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
cin>>n>>m;
string s,t;
cin>>s>>t;
if(n>m+1)
cout<<"NO";
else{
for(int i=0;i<n;i++)
{ if(s[i]=='*')
{ f=1;
break;
}
if(s[i]!=t[i])
{flag=1;
break;}
}
for(int i=n-1;i>0;i--)
{ if(s[i]=='*')
{f=1;break;}
if(s[i]!=t[i+(m-n)])
{flag=1;
break;}
}
if(m>n&&f==0)cout<<"NO";
else
{if(flag==0)
cout<<"YES";
else cout<<"NO";
}
}
return 0;
int i=0;
int n,m;
cin>>n>>m;

string s,t;
cin>>s>>t;
if(m<n-1)
{cout<<"NO"; return 0;}
while(s[i]!='*'&&i<n)
{
if(s[i]!=t[i])
{
cout<<"NO"; return 0;
}
i++;
}
if(i==n&&i==m)
{cout<<"YES";return 0;}
if(i==n&&i!=m)
{cout<<"NO"; return 0;}

i++;
int j=m-(n-i);
for(int k=0;k<=n-i;k++)
{
if(s[i+k]!=t[j+k])
{cout<<"NO"; return 0;}
}
cout<<"YES";
return 0;
}
//_4_4_3_//
//1_5_3_7_6_9_1_1_P