#include<iostream> using namespace std; int main(){ int s[110],max=0,n; cin>>n; for(int i=0;i<n;i++){ cin>>s[i]; if(max<s[i]){ max=s[i]; } } cout<<max<<" …
#include<iostream> using namespace std; int main(){ int n,Q,s[2000]; cin>>n>>Q; for(int i=0;i<n;i++){ cin>>s[i]; } while(Q--){ int min=1000,lo,hi; cin>>lo>>hi; for(int i…
#include<iostream> using namespace std; int judge(int y){ int flag; if(y%400==0){ flag=1; } else if(y%100==0){ flag=0; } else if(y%4==0){ flag=1; } else{ flag=0; } return f…
#include<iostream> #include<vector> using namespace std; int main(){ long ai,aj,bi,bj; cin>>ai>>aj; vector<vector <long long> > a(ai,vector<long long>(aj)); for…
#include<iostream> using namespace std; class function { public: long long f1(long long n){ if(n==1){ return 2; } else if(n==2){ return 1; }else if(n==3){ return 6; } else …
#include<iostream> using namespace std; int main(){ long long n,k,T,m=1,sum=1; cin>>n>>k>>T; for(long long i=1;i<T;i++){ m=(m+((i-1)*n+1+i*n)*n/2)%k; sum+=m; } cout<&…
#include<iostream> #include<queue> #include <typeinfo> using namespace std; int main(){ queue<char> x,y; char ch1[20],ch2[20],z[40]; cin>>ch1>>ch2; int i=0,flag=0;…
#include<iostream> #include<cstring> using namespace std; int main(){ int s1[3][3]={{4,9,2},{3,5,7},{8,1,6}}; int s2[3][3]={{2,9,4},{7,5,3},{6,1,8}}; int s3[3][3]={{8,1,…
#include<iostream> using namespace std; char ch[20]; char judge(int temp){ switch(temp){ case 1:return 'A';break; case 2:return 'B';break; case 3:return 'C';break; case 4:r…
#include<iostream> #include<cstring> using namespace std; int main(){ int b,d,x,y; int s[105][1005]; memset(s,0,sizeof(s)); cin>>d>>b; for(int i=0;i<b;i++){ cin>>x>>y…