repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Xi-Plus/OJ-Code
CF/cf 987B-1.cpp
<filename>CF/cf 987B-1.cpp #include<iostream> using namespace std; int main(){ int x,y; cin>>x>>y; if(x==y){ cout<<"="<<endl; }else if(x == 1) { cout<<"<"<<endl; }else if(y == 1) { cout<<">"<<endl; }else if(x == 2 && y == 3) { cout<<"<"<<endl; }else if(x == 3 && y == 2) { cout<<">"<<endl; }else if(x =...
Xi-Plus/OJ-Code
TOJ/toj 115-2.cpp
<reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 115-2.cpp #include <bits/stdc++.h> using namespace std; int main() { map<int, string> arr; int n, k; string s; cin >> n; while (n--) { cin >> s >> k; arr[k] = s; } for (size_t i = 1; i <= 10; i++) { if (arr.count(i)) { cout << arr[i] << endl; } else { cou...
Xi-Plus/OJ-Code
TOJ/toj 114.cpp
#include <iostream> using namespace std; int main(){ int a[5][6]; for(int q=0;q<5;q++)for(int w=0;w<6;w++)cin>>a[q][w]; bool x=0; for(int q=0;q<=4;q++)for(int w=0;w<=3;w++)if(a[q][w]==a[q][w+1]&&a[q][w+1]==a[q][w+2]){ x=1; break; } for(int q=0;q<=2;q++)for(int w=0;w<=5;w++)if(a[q...
Xi-Plus/OJ-Code
UVa/uva 12019.cpp
<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); string dayname[] = {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"}; int mday [] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int t, m, d; cin>>...
Xi-Plus/OJ-Code
TOJ/toj 137.cpp
<filename>TOJ/toj 137.cpp #include<cstdio> using namespace std; int main() { int n,m; while(~scanf("%d%d",&n,&m)){ if(n==0)break; if(n==1&m==1)printf("1 1 Multiple\n"); else if(n==1)printf("1 %d Impossible\n",m); else if((m-1)%(n-1)!=0)printf("%d %d Impossible\n",n,m); el...
Xi-Plus/OJ-Code
TOJ/toj 153.cpp
<reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 153.cpp #include <iostream> using namespace std; int main(){ int n; cin>>n; while(n--){ long long int a,b,c,d=0,e=0,f=0; cin>>a>>b>>c; if(a>=b&&a>=c){ d=a; if(b>=c){ e=b; f=c; }...
Xi-Plus/OJ-Code
UVa/uva 10323.cpp
<reponame>Xi-Plus/OJ-Code<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; long long v[14]; int main() { ios::sync_with_stdio(false); cin.tie(0); v[0] = 1; for(int q=1; q<100; q++) { v[q] = v[q-1]*q; } int n; while(cin>>n) { if(n<0) { if(n&1) cout<<"Overflow!"<<endl; else cout...
Xi-Plus/OJ-Code
ZJ/zj d636.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; const long long m=10007; long long power(long long a,long long b){ if(b==1) return a; if(b&1){ return power(a,b/2)%m*power(a,b/2)%m*a%m; }else { return power(a,b/2)%m*power(a,b/2)%m; } } int main(){ // ios::sync_with_stdio(fal...
Xi-Plus/OJ-Code
TOJ/toj 161.cpp
<reponame>Xi-Plus/OJ-Code<gh_stars>0 #include<cstdio> //#include<iostream> using namespace std; int main(){ int t; scanf("%d",&t); int a0,a1,m,n,k; while(t--){ scanf("%d%d%d%d",&a0,&a1,&m,&n); int v[n+1]; v[0]=a0; v[1]=a1; for(int q=2;q<=n;q++){ // cout...
Xi-Plus/OJ-Code
TIOJ/tioj 1848.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n;cin>>n; int v[4][n][n]; for(int q=0;q<2;q++){ for(int w=0;w<n;w++){ for(int e=0;e<n;e++){ cin>>v[q][w][e];1 } } } for(int w=0;w<n;w++){ for(int e=0;e<...
Xi-Plus/OJ-Code
TOJ/toj 113.cpp
#include <iostream> using namespace std; int main(){ int n,a=0,b=0; cin>>n; char c; int q=1; for(;q<=n;q++){ cin>>c; if(c=='P')break; a++; } q++; for(;q<=n;q++){ cin>>c; b++; } cin>>c; int x; if(c=='L')x=-1; else x=1; for(in...
Xi-Plus/OJ-Code
TIOJ/tioj 1135.cpp
<reponame>Xi-Plus/OJ-Code // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); long long pow2[33]={1}; for(int q=1;q<=32;q++)pow2[q]=pow2[q-1]*2; int T;cin>>T; while(T--){ long long A,B,C,k; cin>>A>>B>>C>>k; k=pow2[k];...
Xi-Plus/OJ-Code
TOJ/toj 226.cpp
#include<iostream> #include<algorithm> using namespace std; int v[100003]; int main() { int t,n; cin>>t; string s; while(t--){ cin>>s; bool x=0; int len=s.size(); long long int sum=0; for(int q=0;q<len;q++){ if(s[q]=='0')x=1; v[q]=s[q]-'0';...
Xi-Plus/OJ-Code
ZJ/zj c007.cpp
<gh_stars>0 // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); string s; bool x=1; while(getline(cin,s)){ int sz=s.size(); for(int q=0;q<sz;q++){ if(s[q]=='"'){ if(x)cout<<"``"; else cout<<"''"; x^=1; ...
Xi-Plus/OJ-Code
LeetCode/leetcode 201.cpp
<filename>LeetCode/leetcode 201.cpp #include <bits/stdc++.h> #define endl '\n' using namespace std; class Solution { public: long long lowbit(long long x) { return x & (-x); } int rangeBitwiseAnd(int m, int n) { long long temp = (long long)m ^ (long long)n; while (temp - lowbit(temp) != 0) { temp -= low...
Xi-Plus/OJ-Code
TOJ/toj 170.cpp
<reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 170.cpp #include <iostream> using namespace std; void echo_starts(int n,int space){ for(int q=0;q<n;q++){ for(int w=0;w<space;w++)cout<<" "; for(int w=0;w<n-q-1;w++)cout<<" "; for(int w=0;w<q*2+1;w++)cout<<"*"; cout<<endl; } } int main()...
Xi-Plus/OJ-Code
ZJ/zj a541.cpp
<gh_stars>0 // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int n; cin>>n; map<string,bool> v; string s; while(n--){ cin>>s; v[s]=true; } cin>>n; while(n--){ cin>>s; if(v[s])cout<<"yes"<<endl; else cout<<"...
Xi-Plus/OJ-Code
TOJ/toj 185.cpp
#include <algorithm> #include <iostream> using namespace std; int main(){ int t, a[1001], b[1001]; while (cin >> t){ for (int q = 0; q < t; q++)cin >> a[q]; for (int q = 0; q < t; q++)cin >> b[q]; sort(a, a + t); sort(b, b + t); long long int ans = 0; for (int q =...
Xi-Plus/OJ-Code
TOJ/toj 112.cpp
#include <iostream> #include <algorithm> using namespace std; int main(){ int n,a[11]; cin>>n; for(int q=0;q<n;q++)cin>>a[q]; for(int q=n-1;q>=0;q--)cout<<a[q]<<endl; }
Xi-Plus/OJ-Code
TOJ/toj 548.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { // ios::sync_with_stdio(false); // cin.tie(0); long long n, k, v; cin>>n>>k; for(int q=0;q<n; q++){ cin>>v; v=(v+10)*2; v=v*v; if(v>k) { cout<<"BURST!!!"<<endl; break; } cout<<v<<endl; } }
Xi-Plus/OJ-Code
ZJ/zj b807.cpp
<gh_stars>0 // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' #define Debug(A) const double PI=acos(-1); const double eps=10e-6; using namespace std; struct Point{ double x,y; }; bool operator == (Point a,Point b){ return abs(a.x-b.x)<eps&&abs(a.y-b.y)<eps; } bool operator != (Point a,Point b){ retur...
Xi-Plus/OJ-Code
TOJ/toj 214.cpp
<reponame>Xi-Plus/OJ-Code #include <cstdio> #include <algorithm> #include <iomanip> #include <iostream> using namespace std; struct sum{ int id; long long int total; }; bool sor(sum a, sum b){ return a.total < b.total; } int main(){ int t; scanf("%d",&t); while(t--){ int n,m; sc...
Xi-Plus/OJ-Code
TIOJ/tioj 1366.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct T{ string s; int sum; int index; }; bool cmp(T a,T b){ if(a.sum==b.sum) return a.index<b.index; return a.sum<b.sum; } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int n; string s; cin>>n; vector<T> v; fo...
Xi-Plus/OJ-Code
TOJ/toj 597.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; for (int i = 3, j = 5, k = 7; i + j + k <= n; i += 3, j += 5, k += 7) { cout << i << " " << j << " " << k << endl; } }
Xi-Plus/OJ-Code
UVa/uva 10200.cpp
<filename>UVa/uva 10200.cpp<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' #define MAXN 10005 using namespace std; bool notp[MAXN]; vector<int> plist; bool isp(int n){ n=n*n+n+41; for(int p:plist){ if(n%p==0 && n>p){ return false; } } return true; } int main() { ios::sync_with_stdio(false); cin.tie(...
Xi-Plus/OJ-Code
paiza-poh-ando/ando11/C++.cpp
<gh_stars>0 #include <iostream> using namespace std; int main(){ int n; cin>>n; int q[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>q[i][j]; } } int m; cin>>m; int p[m][m]; for(int i=0;i<m;i++){ for(int j=0;j<m;j++){ cin>>p[i][j]; } } for(int i=0;i<=n-m;i++){ for(int j=0;j<=n-m;j++)...
Xi-Plus/OJ-Code
LeetCode/leetcode 974.cpp
<filename>LeetCode/leetcode 974.cpp #include <bits/stdc++.h> using namespace std; class Solution { public: int subarraysDivByK(vector<int>& A, int K) { int sum = 0, ans = 0; unordered_map<int, int> count; count[0] = 1; for (int i = 0; i < A.size(); i++) { sum += A[i]; sum = (sum % K + K) % K; ans ...
Xi-Plus/OJ-Code
CF/cf 987D.cpp
<filename>CF/cf 987D.cpp #include<bits/stdc++.h> using namespace std; int town_goods[100005]; vector<int> G[100005]; vector<int> goods_in_town[105]; priority_queue<int, vector<int>, greater<int> > dis_get_goods[100005]; bool visited[100005]; int main() { int n,m,s,k; cin>>n>>m>>k>>s; for(int q=1; q<=n; q++){ cin>>...
Xi-Plus/OJ-Code
CF/cf 888A.cpp
<filename>CF/cf 888A.cpp #include <bits/stdc++.h> using namespace std; int main() { int n; cin>>n; int v[n]; for(int q=0; q<n; q++) { cin>>v[q]; } int ans=0; for(int q=1; q<n-1; q++) { if(v[q]>v[q-1] && v[q]>v[q+1]) { ans++; } else if(v[q]<v[q-1] && v[q]<v[q+1]) { ans++; } } cout<<ans<<endl; }
Xi-Plus/OJ-Code
TOJ/toj 143.cpp
<gh_stars>0 #include <cstdio> using namespace std; int main(){ int n,m,a,b; while(~scanf("%d%d",&n,&m)){ int v[n]; bool x=0; for(int q=0;q<n;q++)v[q]=0; while(m--){ //¿é¤J¼Ä¤HÃö«Y scanf("%d%d",&a,&b); //¦pªGA¸òB³£¨S¦³¼Ä¤H¡A¨º¥L­Ì´N¤¬¬°¼Ä¤H ...
Xi-Plus/OJ-Code
TOJ/toj 266.cpp
<filename>TOJ/toj 266.cpp // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct T{ int maxbid; long long maxval; }tree[40010]; priority_queue<long long> bucket[10001]; void init(int tid,int l,int r){ tree[tid].maxbid=0; tree[tid].maxval=-1e18; if(l==r) return; int m=(l+r)/2;...
Xi-Plus/OJ-Code
TOJ/toj 123-2.cpp
<filename>TOJ/toj 123-2.cpp #include <bits/stdc++.h> int main() { char a[200010]; scanf("%d", (int*)&a[200005]); scanf("%s %s", &a[1], &a[*(int*)&a[200005] + 3]); a[0] = a[*(int*)&a[200005] + 1] = a[*(int*)&a[200005] + 2] = a[*(int*)&a[200005] * 2 + 3] = '1'; // padding for (int i = 0; i < *(int*)&a[200005] * 2 +...
Xi-Plus/OJ-Code
paiza-poh-enkoi/enkoi-3.cpp
#include <iostream> using namespace std; int main(void) { int t, n; cin >> t >> n; int arr[n]; for (int q = 0; q < n; q++) { cin >> arr[q]; } int sum = 0; for (int q = 0; q < t; q++) { sum += arr[q]; } int ans = sum; for (int q = t; q < n; q++) { sum += arr[q] - arr[q - t]; ans = max(ans, sum); } co...
Xi-Plus/OJ-Code
UVa/uva 10057.cpp
<reponame>Xi-Plus/OJ-Code<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; int v[1000005]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; while(cin>>n) { for(int q=0; q<n; q++) { cin>>v[q]; } sort(v, v+n); if(n&1 || v[n/2-1] == v[n/2]) { cout<<v[(n-1)/2]<<" " ...
Xi-Plus/OJ-Code
UVa/uva 10056.cpp
<reponame>Xi-Plus/OJ-Code #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int s, n, i; double p; cin>>s; cout<<fixed<<setprecision(4); while(s--){ cin>>n>>p>>i; double ans=0; for(int q=0; q<100; q++){ ans+=p*pow(1-p, i-1+n*q); } c...
Xi-Plus/OJ-Code
TOJ/toj 315.cpp
<reponame>Xi-Plus/OJ-Code<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; long long a,b,m; __int128 p(__int128 a,__int128 b){ if(b==0) return 1; if(b%2) return p(a,b/2)%m*p(a,b/2)%m*a%m; return p(a,b/2)%m*p(a,b/2)%m; } int main(){ ios::sync_with_stdio(false); cin.tie(0); ...
Xi-Plus/OJ-Code
TOJ/toj 118.cpp
<reponame>Xi-Plus/OJ-Code #include <iostream> using namespace std; int main(){ int n,z[1001]; cin>>n; int a,b; while(n--){ cin>>a>>b; z[a]=b; } cin>>n; while(n--){ cin>>a>>b; int m=b-z[a]*a; if(m)cout<<m<<endl; else cout<<"The shopkeeper is hon...
Xi-Plus/OJ-Code
default code.cpp
// By xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { // ios::sync_with_stdio(false); // cin.tie(0); }
Xi-Plus/OJ-Code
PEG/peg ioi1513.cpp
<filename>PEG/peg ioi1513.cpp // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; bool cmpwait(pair<int,int>a,pair<int,int>b){ return a.first<b.first; } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int N; cin>>N; vector<pair<int,int>> wait; int a,b; for(int q=0;q<N;...
Xi-Plus/OJ-Code
UVa/uva 10055.cpp
<reponame>Xi-Plus/OJ-Code // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); long long a,b; while(cin>>a>>b){ cout<<abs(a-b)<<endl; } }
Xi-Plus/OJ-Code
TOJ/toj 140.cpp
<filename>TOJ/toj 140.cpp<gh_stars>0 #include<iostream> #include<cmath> using namespace std; int main() { int n; cin>>n; string s; int a,b; while(n--){ cin>>s; a=(s[0]-'A')*26*26+(s[1]-'A')*26+(s[2]-'A'); b=(s[4]-'0')*1000+(s[5]-'0')*100+(s[6]-'0')*10+(s[7]-'0'); if(a...
Xi-Plus/OJ-Code
TOJ/toj 99.cpp
<filename>TOJ/toj 99.cpp #include <iostream> #include <cmath> using namespace std; int main(){ double a,b,c,d; while(cin>>a>>b>>c>>d){ if(fabs(a*d-b*c)<0.00001)cout<<0<<endl; else cout<<1<<endl; } }
Xi-Plus/OJ-Code
ZJ/zj d369.cpp
#include <bits/stdc++.h> using namespace std; int char2int(char c){ switch(c){ case 'I':return 1; case 'V':return 5; case 'X':return 10; case 'L':return 50; case 'C':return 100; case 'D':return 500; case 'M':return 1000; } return 0; } int roman2num(string s){ int l=s.size(); int v[l+1]; v[l]=0; for...
Xi-Plus/OJ-Code
UVa/uva 10515.cpp
<reponame>Xi-Plus/OJ-Code<gh_stars>0 // By KRT girl xiplus #include <iostream> #define endl '\n' using namespace std; int vn[]={1,1,4,4,2,1,1,4,4,2}; int v[][4]={ {0}, {1}, {6,2,4,8}, {1,3,9,7}, {6,4}, {5}, {6}, {1,7,9,3}, {6,8,4,2}, {1,9} }; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); string ...
Xi-Plus/OJ-Code
ZJ/zj d712.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int count(int n){ if(n==1) return 0; if(n&1) return count(n*3+1)+1; return count(n/2)+1; } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int a,b; while(cin>>a>>b){ cout<<a<<" "<<b<<" "; if(a>b)swap(a,b); int an...
Xi-Plus/OJ-Code
TOJ/toj 590.cpp
#include <bits/stdc++.h> using namespace std; int main() { for (int i = 5; i >= 1; i--) { cout << i << endl; } }
Xi-Plus/OJ-Code
TOJ/toj 93.cpp
<reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 93.cpp #include <iostream> using namespace std; int main(){ int a,b,c; while(cin>>a>>b>>c)cout<<(a+b)*c/2<<endl; }
Xi-Plus/OJ-Code
paiza-poh-ando/ando12/C++.cpp
<reponame>Xi-Plus/OJ-Code<filename>paiza-poh-ando/ando12/C++.cpp<gh_stars>0 #include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int x,y,z; cin>>x>>y>>z; vector<int> xl,yl; xl.push_back(0); xl.push_back(x); yl.push_back(0); yl.push_back(y); int q,d,a,xn=1,yn=1; cin>>q; w...
Xi-Plus/OJ-Code
UVa/uva 10583.cpp
<gh_stars>0 // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int v[50010]; int find(int n){ if(n==v[n])return n; return v[n]=find(v[n]); } bool bfs(int a,int b){ a=find(a); b=find(b); v[b]=a; if(a==b)return 0; return 1; } int main(){ // ios::sync_with_stdio(false); // cin.tie...
Xi-Plus/OJ-Code
UVa/uva 10110.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; bool isp[65536]; int main() { ios::sync_with_stdio(false); cin.tie(0); isp[0] = isp[1] = 1; for(int q=2; q<65536; q++) { for(int w=q*2; w<65536; w+=q) { isp[w] = 1; } } vector<int> p; for(int q=2; q<65536; q++) { if(!isp[q]) p.emplace_back(...
Xi-Plus/OJ-Code
TOJ/toj 312.cpp
<filename>TOJ/toj 312.cpp // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int v[2][100010],ans[100010]; int n=0; bool debug=0; // 0,1,2,3,4,5,6,7,8, 9,10,11,12,13,14,15,16,17,18 int poss[]={1,2,3,4,5,6,7,8,9,10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; int has0[]={1,1,1,1,1,1,1,1,1, 1,...
Xi-Plus/OJ-Code
UVa/uva 10642.cpp
<filename>UVa/uva 10642.cpp #include <bits/stdc++.h> #define endl '\n' using namespace std; int calc(int x, int y){ return (x+y+1)*(x+y+2)/2-y; } int main() { ios::sync_with_stdio(false); cin.tie(0); int T, a, b, c, d; cin>>T; for(int t=1; t<=T; t++){ cin>>a>>b>>c>>d; cout<<"Case "<<t<<": "<<calc(c, d)-calc(a...
Xi-Plus/OJ-Code
CF/cf 735C.cpp
// By xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); long long v[100]={0,1}; for(int q=2;;q++){ v[q]=v[q-1]+v[q-2]; if(v[q]>1e18)break; } long long n; cin>>n; cout<<upper_bound(v,v+88,n)-v-3<<endl; }
Xi-Plus/OJ-Code
UVa/uva 10054.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct Side{ bool visit; int a,b; }; struct Node{ vector<pair<int,bool>> side; }node[51]; vector<Side> side; vector<pair<int,int>> ans; void dfs(int p){ int sz=node[p].side.size(); for(int q=0;q<sz;q++){ if(!side[node[p].side[q...
Xi-Plus/OJ-Code
TOJ/toj 547.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { // ios::sync_with_stdio(false); // cin.tie(0); cout<<"Hello World"<<endl; }
Xi-Plus/OJ-Code
TOJ/toj 222.cpp
<reponame>Xi-Plus/OJ-Code #include<cstdio> using namespace std; int main() { int t,ans; scanf("%d",&t); int a,b,c,n; while(t--){ scanf("%d%d%d%d",&n,&a,&b,&c); if(2*b>(a+c)) printf("%d/1\n",n*b); else { ans=n*(a+c); if(ans%2==0)printf("...
Xi-Plus/OJ-Code
TOJ/toj 154.cpp
#include <cstdio> #include <algorithm> using namespace std; struct V{ int i; int m; }; int cmp(V a,V b) { return a.m>b.m; } int cmp2(V a,V b) { return a.i<b.i; } int main(){ int t; scanf("%d",&t); while(t--){ int n; scanf("%d",&n); V v[n]; for(int q=0;q<n;q++)...
Xi-Plus/OJ-Code
TOJ/toj 115.cpp
#include <iostream> using namespace std; int main(){ string s[11]; for(int q=1;q<=10;q++)s[q]="EMPTY"; int n; cin>>n; while(n--){ string i; int k; cin>>i>>k; s[k]=i; } for(int q=1;q<=10;q++)cout<<s[q]<<endl; }
Xi-Plus/OJ-Code
TOJ/toj 283.cpp
<reponame>Xi-Plus/OJ-Code // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct number{ int n[4]; }; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int a,b; cout<<"0123"<<endl; while(cin>>a>>b){ vector<number> v; for(int q=0;q<10;q++){ for(int w=0;w<10;w++){...
Xi-Plus/OJ-Code
PEG/peg ioi1511.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int N,K,L; cin>>N>>K>>L; vector<int> left,right; int t; for(int q=0;q<N;q++){ cin>>t; if(t==0); else if(t<=L/2)left.push_back(t); else right.push_back(L-t); } r...
Xi-Plus/OJ-Code
TOJ/toj 149.cpp
#include <cstdio> #include <algorithm> #include <vector> #include <iostream> using namespace std; struct V{ int b; // int s; int g; //bool x; }; int sortg(V a,V b) { return a.g>b.g; } /*int sortb(V a,V b) { return a.b<b.b; }*/ int main(){ int n; long long int m; scanf("%d%lld",&n,&m);...
Xi-Plus/OJ-Code
UVa/uva 11360.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int t; cin>>t; for(int cas=1;cas<=t;cas++){ int n; cin>>n; int v[n][n]; char c; for(int q=0;q<n;q++){ for(int w=0;w<n;w++){ cin>>c; v[q][w]=c-'0'; }...
Xi-Plus/OJ-Code
TOJ/toj 105.cpp
#include <iostream> using namespace std; int main(){ long long int a=2; for(int q=1;q<=25;q++){ a=a*2+1; } cout<<a<<endl; }
Xi-Plus/OJ-Code
UVa/uva 10415.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); map<char, string>p; p[' ']="0000000000"; p['c']="0111001111"; p['d']="0111001110"; p['e']="0111001100"; p['f']="0111001000"; p['g']="0111000000"; p['a']="0110000000"; p['b']="0100000000"; p[...
Xi-Plus/OJ-Code
TOJ/toj 326.cpp
<reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 326.cpp // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); string s; char c; while(cin>>s){ stringstream ss(s); unsigned long long n=0; while(ss>>c&&c!='.'){ n*=10; n+=...
Xi-Plus/OJ-Code
ZJ/zj a017.cpp
<gh_stars>0 // By xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; vector<char> op; vector<int> ans; map<char, int> oporder; int a, b; bool ophigher(char op1, char op2) { return oporder[op1] < oporder[op2]; } void action(char c) { b = ans.back(); ans.pop_back(); a = ans.back(); ans.pop_back(); ...
Xi-Plus/OJ-Code
TOJ/toj 108.cpp
#include <iostream> using namespace std; int main(){ int a,b,c,d,e; cin>>a>>b>>c; a-=c; while(b--){ cin>>d>>e; a+=d*e; } cout<<a/4<<endl; }
Xi-Plus/OJ-Code
TOJ/toj 145.cpp
#include <iostream> using namespace std; int main(){ int n,m,k,q,a,b,c,d; while(cin>>n>>m>>k>>q){ int v[n+1][m+1]; for(int e=0;e<=n;e++)for(int w=0;w<=m;w++)v[e][w]=0; while(k--){ cin>>a>>b; v[a+1][b+1]++; } /*for(int e=0;e<=n;e++){ for...
Xi-Plus/OJ-Code
template/BigNumber.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct BigNumber{ const int BASE = 100000000; const int WIDTH = 8; vector<int> s; bool sign=0; operator long long(){ long long num=0; int sz=s.size(); for(int i=sz-1;i>=0;i--){ num*=BASE; num+=s[i]; } if(sign)re...
Xi-Plus/OJ-Code
UVa/uva 10008.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; bool cmp(pair<char, int> a, pair<char, int> b){ if(b.second==a.second){ return a.first<b.first; } return a.second>b.second; } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin>>n; cin.ignore(); string s; set<char> chars; map<cha...
Xi-Plus/OJ-Code
TOJ/toj 442.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int pp[10000005]; int main() { ios::sync_with_stdio(false); cin.tie(0); for(int q=1; q<10000005; q++) { pp[q] = q; } for(int q=2; q<3165; q++) { if(pp[q] == q) { for(int w=q*2; w<10000005; w+=q) { while(pp[w]%q==0 && pp[w] != q) pp[w] /= q;...
Xi-Plus/OJ-Code
TIOJ/tioj 1080.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; const int MAX=100010; int bit[MAX]; int lowerbit(int x){ return x&-x; } void add(int x){ while(x<=MAX){ bit[x]++; x+=lowerbit(x); } } int sum(int x){ int ans=0; while(x){ ans+=bit[x]; x-=lowerbit(x); } return ans; } int...
Xi-Plus/OJ-Code
TOJ/toj 114-gen.cpp
<gh_stars>0 #include <iostream> using namespace std; int main(){ cout<<"#include<iostream>"<<endl; cout<<"using namespace std;"<<endl; cout<<"int main() {"<<endl; cout<<"int "; for(int i=1;i<=29; i++){ cout<<"a"<<i<<", "; } cout<<"a30;"<<endl; cout<<"cin"; for(int i=1;i<=30; i++){ cout<<">>a"<<i; } ...
Xi-Plus/OJ-Code
UVa/uva 11349.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int T; cin>>T; char c; int n; long long a[105][105]; for(int t=1; t<=T; t++){ cin>>c>>c>>n; bool ans=true; for(int q=0; q<n; q++){ for(int w=0; w<n; w++){ cin>>a[q][w]; if(a[q][...
Xi-Plus/OJ-Code
TOJ/toj 320/toj 320.cpp
<reponame>Xi-Plus/OJ-Code // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int v[1010]; memset(v,0x3f,sizeof(v)); v[1]=0; for(int q=1;q<=200;q++){ v[q]=min(v[q],v[q-1]+1); v[q*2]=v[q]+1; v[q*3]=v[q]+2; v[q*5]=v[q...
Xi-Plus/OJ-Code
TOJ/toj 81.cpp
#include "Pikachu.h" int main(){ Answer(Init()*2); }
Xi-Plus/OJ-Code
TOJ/toj 513.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { // ios::sync_with_stdio(false); // cin.tie(0); int a, b, c, d; cin>>a>>b>>c>>d; c-=a; d-=b; if(d<0){ d+=60; c--; } if(c<0){ c+=24; } cout<<"totally "<<c<<" hours and "<<d<<" minutes."<<endl; }
Xi-Plus/OJ-Code
TOJ/toj 227.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); int t;cin>>t; while(t--){ int n;cin>>n; vector<int> vo; int k; for(int q=0;q<n;q++){ cin>>k; vo.push_back(k);...
Xi-Plus/OJ-Code
UVa/uva 10326.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; void del1(long long n){ if(n!=1)cout<<n; } int main(){ // ios::sync_with_stdio(false); // cin.tie(0); long long n,t; while(cin>>n){ if(n==0){ cout<<"1 = 0"<<endl; continue; } long long v[n+1],v2[n+1]; memset(v,0,sizeo...
Xi-Plus/OJ-Code
ZJ/zj d068.cpp
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; cout << n - (n > 50) << endl; }
Xi-Plus/OJ-Code
UVa/uva 10810.cpp
<reponame>Xi-Plus/OJ-Code #include <bits/stdc++.h> #define endl '\n' using namespace std; int bit[500005]; int arr[500005]; int arr2[500005]; int n; void add(int x, int v) { while (x <= n) { bit[x] += v; x += (x&(-x)); } } int get(int x) { int ans = 0; while (x > 0) { ans += bit[x]; x -= (x&(-x)); } retur...
Xi-Plus/OJ-Code
TOJ/toj 147.cpp
#include <cstdio> //c¿é¤J¿é¥X //#include <fstream> //#include <sstream> //cmd //#include <conio.h> //if(kbhit()) //#include <windows.h> //#include <ctime> //time srand(time(NULL)); #include <algorithm> //sort(n,n+k) reverse //#include <iomanip> //¤p¼Æ fixed<<setprecision or setw //#include <cstdlib> //system //#in...
Xi-Plus/OJ-Code
TOJ/toj 229.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int v1[100010],v2[100010],v3[200020],v4[200020]; int main(){ ios::sync_with_stdio(false); cin.tie(0); int T,N,K,x,y,d; cin>>T; while(T--){ memset(v1,0,sizeof(v1)); memset(v2,0,sizeof(v2)); m...
Xi-Plus/OJ-Code
template/rand - long long.cpp
<filename>template/rand - long long.cpp // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; long long RAND(long long a,long long b){ long long m=b-a+1; int d=int(log2(m-1))+1; long long res=m+1; while(res>=m){ res=0; for(int q=0;q<d;q++){ res<<=1; res|=rand()%2; } } r...
Xi-Plus/OJ-Code
TOJ/toj 553.cpp
<reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 553.cpp<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { // ios::sync_with_stdio(false); // cin.tie(0); int n; string a, b; cin>>n>>a>>b; int ans=0; for(int q=0; q<n; q++){ ans+=a[q]!=b[q]; } cout<<max(ans-2, 0)<<endl; }
Xi-Plus/OJ-Code
ZJ/zj a683.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); long long n,k; while(cin>>n>>k){ } }
Xi-Plus/OJ-Code
IOI/ioi 2015 boxes.cpp
<filename>IOI/ioi 2015 boxes.cpp // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; long long delivery(int N,int K,int L,int p[]){ vector<int> left,right; for(int q=0;q<N;q++){ if(p[q]==0); else if(p[q]<=L/2)left.push_back(p[q]); else right.push_back(L-p[q]); } reverse(right...
Xi-Plus/OJ-Code
UVa/uva 11063.cpp
<filename>UVa/uva 11063.cpp #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, arr[105]; int t=1; while(cin>>n){ bool ans=true; for(int q=0; q<n; q++){ cin>>arr[q]; if(arr[q]<1){ ans=false; } } for(int q=0; q<n-1; q++){ ...
Xi-Plus/OJ-Code
ZJ/zj d517.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int t; string s; while(cin>>t){ map<string,int> v; int n=0; while(t--){ cin>>s; if(v[s]) cout<<"Old! "<<v[s]<<endl; else { v[s]=++n; cout<<"New! "<<n...
Xi-Plus/OJ-Code
UVa/uva 10295.cpp
<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); map<string, int> point; int m, n, p; cin>>m>>n; string s; while(m--){ cin>>s>>p; point[s]=p; } while(n--){ int ans=0; while(cin>>s, s!="."){ ans+=point[s]; } cout<<an...
Xi-Plus/OJ-Code
TOJ/toj 92.cpp
<filename>TOJ/toj 92.cpp #include <iostream> using namespace std; int main(){ string a,b,c; cin>>a>>b>>c; cout<<"Hello, "<<a<<", "<<b<<", and "<<c<<"!"<<endl; }
Xi-Plus/OJ-Code
UVa/uva 10976.cpp
// By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; int main(){ // ios::sync_with_stdio(false); // cin.tie(0); int n; while(cin>>n){ vector<int> ans; for(int q=n+1;q<=2*n;q++){ if((q*n)%(q-n)==0){ ans.push_back(q); } } cout<<ans.size()<<endl; for(auto i:ans){ c...
Xi-Plus/OJ-Code
TOJ/toj 499.cpp
#include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { // ios::sync_with_stdio(false); // cin.tie(0); string a, b; int n; getline(cin, a); cin>>n; cin.ignore(); for(int q=0; q<n; q++){ getline(cin, b); if(a==b){ cout<<q+1<<" "; } } cout<<endl; }
Xi-Plus/OJ-Code
UVa/uva 10220.cpp
<gh_stars>0 #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; while(cin>>n){ vector<int> ans; ans.push_back(1); for(int q=2; q<=n; q++){ for(int w=ans.size()-1; w>=0; w--){ ans[w]*=q; } for(int w=0; w<ans.size(); w++){ ...
Xi-Plus/OJ-Code
TOJ/toj 36.cpp
#include <cstdio> using namespace std; int main(){ long long int b; int a,c,v[100000],max; while(~scanf("%d%lld%d",&a,&b,&c)){ a%=c; v[1]=a; for(max=1;;max++){ v[max+1]=v[max]*a%c; if(v[max+1]==a)break; } printf("%d\n",v[(b%max==0?max:b%max)]%...
Xi-Plus/OJ-Code
TOJ/toj 618.cpp
<filename>TOJ/toj 618.cpp #include <bits/stdc++.h> using namespace std; int main() { cout << "Hello 8th junior programming camp practice contest!" << endl; }
Xi-Plus/OJ-Code
TOJ/toj 589.cpp
<reponame>Xi-Plus/OJ-Code #include <bits/stdc++.h> using namespace std; int main() { for (int i = 6; i <= 10; i++) { cout << i << endl; } }
Xi-Plus/OJ-Code
UVa/uva 10190.cpp
<filename>UVa/uva 10190.cpp #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, n2, m; while(cin>>n>>m){ stringstream ans; bool fail=false; ans<<n; if(m<=1||n<=1){ fail=true; }else{ while(n>1){ if(n%m!=0){ fail=true; ...
Xi-Plus/OJ-Code
TIOJ/tioj 1318.cpp
<reponame>Xi-Plus/OJ-Code // By KRT girl xiplus #include <bits/stdc++.h> #define endl '\n' using namespace std; struct probinfo{ long long T[3]; int used=0; }; struct costlist{ long long cost; long long costsum; long long score; long long probid; long long diff; }; bool cmp_sort(costlist a,costlist b){ if(a.cos...
Xi-Plus/OJ-Code
UVa/uva 1207.cpp
<reponame>Xi-Plus/OJ-Code<filename>UVa/uva 1207.cpp #include <bits/stdc++.h> #define endl '\n' using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int lx, ly; string x, y; while(cin>>lx>>x>>ly>>y){ int dp[lx+1][ly+1]; for(int q=0; q<=lx; q++){ dp[q][0]=q; } for(int q=0; q<=ly; q++...