repo_name stringlengths 5 122 | path stringlengths 3 232 | text stringlengths 6 1.05M |
|---|---|---|
ykwon0407/VIPS | c++/GMM.cpp | #define _USE_MATH_DEFINES
#include "GMM.h"
#include "Utils.h"
#include <random>
#include <ctime>
using namespace std; // ToDo: Test whether save to remove
using namespace arma;
/**
* A Gaussian Mixture Model.
* @param dim the number of dimensions
* @param max_components maximum number of components this GMM may comp... |
ykwon0407/VIPS | c++/More.cpp | <filename>c++/More.cpp
//
// Created by arenz on 18.07.17.
//
#include "More.h"
#include <nlopt.hpp>
#include <exception>
double nlopt_objective(const std::vector<double> &x, std::vector<double> &grad, void* instance) {
More * obj = (More *) instance;
double dualVal;
vec gradient;
std::tie(dualVal, gradie... |
ykwon0407/VIPS | c++/SampleDatabase.cpp | <gh_stars>1-10
#include "SampleDatabase.h"
/**
* A SampleDatabase keeps track of samples and the Gaussian distributions that generated them.
* This information is used to create a concise GMM background distribution that can be used
* for computing importance weights.
*/
SampleDatabase::SampleDatabase(int num_dimen... |
ykwon0407/VIPS | c++/Utils.cpp | #include "Utils.h"
#define _USE_MATH_DEFINES
/**
* Helper function for evaluating samples on Gaussian
*/
vec gaussian_pdf(mat chol_inv, mat sample_diff, bool return_log) {
double offset = -0.5 * chol_inv.n_cols * log(2 * M_PI);
vec logpdf(sample_diff.n_cols, fill::none);
double logDet_by2 = arma::sum(log(chol_in... |
MrChip53/Play- | Source/gs/GSH_Vulkan/GSH_VulkanPresent.cpp | #include "GSH_VulkanPresent.h"
#include "GSH_VulkanMemoryUtils.h"
#include "MemStream.h"
#include "vulkan/StructDefs.h"
#include "nuanceur/Builder.h"
#include "nuanceur/generators/SpirvShaderGenerator.h"
using namespace GSH_Vulkan;
#define DESCRIPTOR_LOCATION_BUFFER_MEMORY 0
#define DESCRIPTOR_LOCATION_IMAGE_SWIZZLET... |
MrChip53/Play- | Source/ui_qt/ControllerConfig/controllerconfigdialog.cpp | <filename>Source/ui_qt/ControllerConfig/controllerconfigdialog.cpp
#include "controllerconfigdialog.h"
#include "ui_controllerconfigdialog.h"
#include <QRegularExpression>
#include <QLabel>
#include <QFile>
#include <QAbstractButton>
#include <QPushButton>
#include <QInputDialog>
#include "AppConfig.h"
#include "Pref... |
MrChip53/Play- | Source/iop/Iop_Dmacman.cpp | <filename>Source/iop/Iop_Dmacman.cpp
#include "Iop_Dmacman.h"
#include "Iop_Dmac.h"
#include "Iop_DmacChannel.h"
#include "../Log.h"
#define LOGNAME "iop_dmacman"
using namespace Iop;
#define FUNCTIONID_DMACREQUEST 28
#define FUNCTIONID_DMACTRANSFER 32
#define FUNCTION_DMACREQUEST "DmacRequest"
#define FUNCTION_DMA... |
MrChip53/Play- | tools/VuTest/FlagsTest3.cpp | <reponame>MrChip53/Play-<filename>tools/VuTest/FlagsTest3.cpp
#include "FlagsTest3.h"
#include "VuAssembler.h"
void CFlagsTest3::Execute(CTestVm& virtualMachine)
{
virtualMachine.Reset();
auto microMem = reinterpret_cast<uint32*>(virtualMachine.m_microMem);
//Inspired by Kingdom Hearts 2 - Very simple flags test
... |
MrChip53/Play- | Source/ee/PS2OS.cpp | #include <cstring>
#include <stddef.h>
#include <stdlib.h>
#include <exception>
#include "string_format.h"
#include "PS2OS.h"
#include "StdStream.h"
#ifdef __ANDROID__
#include "android/AssetStream.h"
#endif
#include "PtrMacro.h"
#include "../Ps2Const.h"
#include "../DiskUtils.h"
#include "../ElfFile.h"
#include "../CO... |
MrChip53/Play- | Source/ui_qt/outputwindow.cpp | <reponame>MrChip53/Play-
#include "outputwindow.h"
#include <QResizeEvent>
OutputWindow::OutputWindow(QWindow* parent)
: QWindow(parent)
{
connect(this, SIGNAL(activeChanged()), this, SLOT(activeStateChanged()));
}
void OutputWindow::keyPressEvent(QKeyEvent* ev)
{
emit keyDown(ev);
}
void OutputWindow::keyRele... |
BlackDev92/building-simulator | logger/src/Logger.tpp | /*
* Logger.cpp
*
* Created on: 25-12-2018
* Author: <NAME>
*/
using namespace logger;
Logger::Logger(string className, Target target): className(className),
target(target){
if (target == Target::FILE)
outputFile = fopen(className.c_str(), "a");
}
Logger::~Logger() {
if (outputFile != NU... |
BlackDev92/building-simulator | environment/main.cpp | <filename>environment/main.cpp
#include <unistd.h>
#include <iostream>
#include <sys/stat.h>
#include <sys/types.h>
#include <fcntl.h>
#include <unistd.h>
#include "configuration.h"
#include "Period.h"
#include "boost/math/interpolators/barycentric_rational.hpp"
#include "utills.h"
#include "Event.h"
using namespace s... |
BlackDev92/building-simulator | environment/Period.cpp | <gh_stars>0
//
// Created by bartek on 26.03.19.
//
#include "Period.h"
#include <string>
#include <regex>
#include "boost/algorithm/string.hpp"
using namespace utils;
using boost::algorithm::to_lower_copy;
Period::Period(const std::string &strPeriod) {
std::smatch match;
if (regex_match(strPeriod, match, PE... |
BlackDev92/building-simulator | environment/configuration.cpp | //
// Created by bartek on 25.03.19.
//
#include "configuration.h"
#include <regex>
#include <iostream>
#include <vector>
#include <string>
#include "yaml-cpp/yaml.h"
#include "utills.h"
namespace configuration {
template<typename Config>
Config loadConfiguration(const std::string &path) {
const YAML... |
BlackDev92/building-simulator | environment/Event.cpp | //
// Created by bartek on 30.03.19.
//
#include "Event.h"
#include <string>
using namespace event;
Event::Event(configuration::Time &time, float_t temperature) : time(time), temperature(temperature) {}
std::string Event::toString() const {
char buffer[50];
snprintf(buffer, sizeof(buffer), "@environment\nti... |
BlackDev92/building-simulator | building-dao/src/implementation/DAO.cpp | <gh_stars>0
/*
* DAO.cpp
*
* Created on: 24-12-2018
* Author: <NAME>
*/
#include "DAO.h"
DAO::DAO(const char * dbName) {
dbHandle = qdb_connect(dbName, 0);
if (dbHandle == nullptr) {
fprintf(stderr, "Connect failed: %s\n", "ERROR");
}
}
DAO::~DAO() {
if (dbHandle == nullptr)
return;
i... |
Xi-Plus/OJ-Code | TIOJ/tioj 1056.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int v[3][3];
char temp;
bool x=1;
int count[3]={0,0,0};
int win[2]={0,0};
for(int q=0;q<3;q++){
for(int w=0;w<3;w++){
cin>>temp;
switch(temp){
case 'O': v[q][w]=0;break;
ca... |
Xi-Plus/OJ-Code | TIOJ/tioj 1344.cpp | <reponame>Xi-Plus/OJ-Code
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int c2n(char c){
if(c=='M')return 1;
else if(c=='B')return 2;
else return 4;
}
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
int n,i;
char c;
while(cin>>n){
int la1=0,la2=0,lb1=0,lb2=0,an... |
Xi-Plus/OJ-Code | UVa/uva 524.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
// 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
bool isp[]={0,0,1,1,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,1,0,0,0,1,0,0,0,0,0,1,0,1,0};
int n;
int A[16]={1};
bool used[17]={1,1};
void dfs(int i){
if(i==n){
if(... |
Xi-Plus/OJ-Code | UVa/uva 374.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
long long calc(long long b, long long p, long long m) {
if(p == 0) return 1;
long long tmp = calc(b, p/2, m)%m;
if(p&1) return tmp*tmp*b%m;
return tmp*tmp%m;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long b, p, m;
while(cin>>b>>p... |
Xi-Plus/OJ-Code | paiza-poh-ando/ando10/C++.cpp | <gh_stars>0
#include <iostream>
using namespace std;
int main(){
int n,a=1;
cin>>n;
while(n)a*=n--;
cout<<a;
}
|
Xi-Plus/OJ-Code | TOJ/toj 23.cpp | <reponame>Xi-Plus/OJ-Code
#include "interactive.h"
using namespace std;
int main(){
Init();
Answer(get_num_of_boy()*get_num_of_girl());
} |
Xi-Plus/OJ-Code | TOJ/toj 552.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
// ios::sync_with_stdio(false);
// cin.tie(0);
int k, n;
cin>>k>>n;
long long v[70]={0, 1};
for(int q=1; q<=n; q++){
for(int w=q; w>=1; w--){
v[w]+=v[w-1];
}
if(q>=k+1){
for(int w=0; w<n-q; w++){
cout<<" ";
}
for(int ... |
Xi-Plus/OJ-Code | UVa/uva 10810/uva 10810 testdata.cpp | // By xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
srand(time(NULL));
int n=100000;
cout<<n<<endl;
for(int q=0;q<n;q++){
cout<<rand()%10000<<endl;
}
cout<<0<<endl;
}
|
Xi-Plus/OJ-Code | TOJ/toj 98.cpp | #include <iostream>
using namespace std;
int main(){
long long int v=299792458;
cout<<"1 Light-second(LS) is "<<v<<" metres."<<endl;
cout<<"1 Light-minute(LM) is "<<v*60<<" metres."<<endl;
cout<<"1 Light-hour(LH) is "<<v*3600<<" metres."<<endl;
cout<<"1 Light-day(LD) is "<<v*86400<<" metres."<<endl;... |
Xi-Plus/OJ-Code | UVa/uva 10603.cpp | <gh_stars>0
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
bool visited[205][205];
int jug[3], d, ans, change;
struct Node{
int v[3];
int cost;
bool operator<(const Node& rhs) const {
return cost > rhs.cost;
}
};
void bfs(){
priority_queue<Node>que;
memset(visited, 0, sizeof(visited));
Node ... |
Xi-Plus/OJ-Code | UVa/uva 10409.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, t;
string s;
while(cin>>n, n){
int a[]={1,2,3,6,5,4};//top,N,W,bot,S,E
while(n--){
cin>>s;
switch(s[0]){
case 'n':
t=a[0];
a[0]=a[4];
a[4]=a[3];
... |
Xi-Plus/OJ-Code | TOJ/toj 467.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct Record{
string name;
int a, b, rank;
};
bool cmp(Record r1, Record r2){
if(r1.a==r2.a){
if(r1.b==r2.b){
if(r1.name.size()==r2.name.size()){
return r1.name<r2.name;
}
return r1.name.size()<r2.name.size();
}
return r1.b<r2.b;
}
... |
Xi-Plus/OJ-Code | TIOJ/tioj 1204.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
string pre,in;
int used,lastnode,root;
struct Node{
int parent,left,right,value;
};
vector<Node>node;
void add(int t){
used++;
if(t<node[lastnode].value){
while(node[lastnode].parent!=-1&&t<node[node[lastnode].parent].value){
... |
Xi-Plus/OJ-Code | TOJ/toj 273.cpp | <reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 273.cpp
//#include <bits/stdc++.h>
#include <iostream>
#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;
for(int q=0;q<n;q++){
for(int w=... |
Xi-Plus/OJ-Code | TIOJ/tioj 1198.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int now[9],goal[9];
int bfs(int d,int x0,int y0,int ans){
if(memcmp(now,goal,sizeof(now))==0)return ans;
// if()
}
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
int zero;
for(int q=0;q<9;q++){
cin>>now[q];
if(now[q... |
Xi-Plus/OJ-Code | UVa/uva 294.cpp | <gh_stars>0
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
bool notp[46340];
vector<int> plist;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
for(int q=2; q<46340; q++){
if(!notp[q]){
plist.push_back(q);
}
for(int w=q*2; w<46340; w+=q){
notp[w]=true;
}
}
int n, l, u;
cin>>n;... |
Xi-Plus/OJ-Code | UVa/uva 10684.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int v[10005];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, ans;
while(cin>>n, n) {
v[0]=0;
for(int q=1; q<=n; q++) {
cin>>v[q];
if(v[q-1]>0){
v[q]+=v[q-1];
}
}
ans=0;
for(int q=1; q<=n; q++) {
ans=max(ans, v[q]... |
Xi-Plus/OJ-Code | ZJ/zj a091.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);
deque<int> v;
int k,n;
while(cin>>k){
if(k==1){
cin>>n;
v.push_back(n);
sort(v.begin(),v.end());
}else if(k==2){
cout<<v.back()<<endl;
v.pop_back();
}e... |
Xi-Plus/OJ-Code | UVa/uva 101.cpp | <reponame>Xi-Plus/OJ-Code<gh_stars>0
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct Node{
int now;
int parent;
int son;
}node[25];
void init(int n){
for(int q=0;q<n;q++){
node[q]={q,-1,-1};
}
}
void reset(int a){
if(a!=-1){
// cout<<"reset "<<a<<endl;
reset(node[... |
Xi-Plus/OJ-Code | TOJ/toj 261.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long double a,b;
while(cin>>a>>b){
if(a==b&&a>=0&&b>=0)cout<<"Nymphia"<<endl;
else cout<<"Fake"<<endl;
}
return 0;
} |
Xi-Plus/OJ-Code | UVa/uva 11059.cpp | <filename>UVa/uva 11059.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;
int t=1;
while(cin>>n){
int v[n+1];
for(int q=0;q<n;q++){
cin>>v[q];
}
v[n]=0;
long long ans=0,maxr=0,maxm=0;
for(int q=0;... |
Xi-Plus/OJ-Code | UVa/uva 10908.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t, m, n, k, x, y;
char a[105][105];
cin>>t;
while(t--){
cin>>m>>n>>k;
memset(a, ' ', sizeof(a));
for(int q=1; q<=m; q++){
for(int w=1; w<=n; w++){
cin>>a[q][w];
}
}
cout<<m... |
Xi-Plus/OJ-Code | UVa/uva 10550.cpp | <filename>UVa/uva 10550.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;
while(cin>>a>>b>>c>>d, a||b||c||d){
int ans=1080;
cout<<1080+9*(a-b<0?a-b+40:a-b)+9*(c-b<0?c-b+40:c-b)+9*(c-d<0?c-d+40:c-d)<<endl;
}
}
|
Xi-Plus/OJ-Code | CF/cf 625D.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=1;
bool solve(int k,int l){
if(debug)cout<<"solve"<<k<<endl;
int r=n-1;
while(l<=r){
if(debug)cout<<l<<" "<<r<<" "<<v[k][l]<<" "<<v[k][r]<<endl;
if(l==r){
if(v[k][l]%2){
... |
Xi-Plus/OJ-Code | TOJ/toj 469.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
long long cnt[10000005];
int main() {
// ios::sync_with_stdio(false);
// cin.tie(0);
for(int q=2; q<10000005; q++){
for(int w=q; w<10000005; w+=q){
cnt[w]++;
}
}
for(int q=1; q<10000005; q++){
cnt[q] += cnt[q-1]+1;
}
map<char, int> number;
p... |
Xi-Plus/OJ-Code | TOJ/toj 242.cpp | <reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 242.cpp
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct Tree{
Tree *l,*r;
int sum;
int color; //1=blue 2=yellow 3=mixed
int lcolor,rcolor;
Tree(){
l=r=NULL;
sum=0;
color=lcolor=rcolor=2;
}
};
void up(Tree *id){
id->colo... |
Xi-Plus/OJ-Code | TOJ/toj 94.cpp | #include <iostream>
using namespace std;
int main(){
int a;
while(cin>>a){
switch(a){
case 3:
case 4:
case 5:
cout<<"Spring!"<<endl;
break;
case 6:
case 7:
case 8:
cout<<"Summer!"<<end... |
Xi-Plus/OJ-Code | TOJ/toj 550.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
// ios::sync_with_stdio(false);
// cin.tie(0);
int n;
string s;
while(cin>>n) {
long long a=INT_MAX, b=0, sz;
cin.ignore();
for(int q=0; q<n; q++){
getline(cin, s);
sz=s.size();
a=min(a, sz);
b=max(b,sz);
cout<<sz<<endl... |
Xi-Plus/OJ-Code | TOJ/toj 181.cpp | #include <cmath>
#include <iostream>
using namespace std;
int main(){
char c[64];
for (int q = 0; q < 26; q++)c[q] = 'A' + q;
for (int q = 0; q < 26; q++)c[26 + q] = 'z' - q;
for (int q = 0; q < 5; q++)c[52 + q] = '0' + q * 2;
for (int q = 0; q < 5; q++)c[57 + q] = '1' + q * 2;
int n;
while ... |
Xi-Plus/OJ-Code | TOJ/toj 104.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int q=1;q<=n;q++){
for(int w=1;w<=n-q;w++)cout<<" ";
for(int w=1;w<=q*2-1;w++)cout<<"*";
cout<<endl;
}
} |
Xi-Plus/OJ-Code | TOJ/toj 106.cpp | #include <iostream>
using namespace std;
int main(){
long long int a=2;
while(true){
a=a*2+1;
if(a%71==0)break;
}
if(a%3==0)cout<<"right"<<endl;
else cout<<"left"<<endl;
} |
Xi-Plus/OJ-Code | TOJ/toj 37.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;
while(getline(cin,s)){
int ans=0;
stringstream ss;
ss<<s;
int t;
while(ss>>t){
ans++;
}
cout<<ans<... |
Xi-Plus/OJ-Code | TOJ/toj 624.cpp | <gh_stars>0
#include <bits/stdc++.h>
using namespace std;
int main() {
int a[2];
cin >> a[0] >> a[1];
int gcd = __gcd(a[0], a[1]);
a[0] /= gcd;
a[1] /= gcd;
stack<pair<int, int>> s;
while (a[0] && a[1]) {
if (a[0] >= a[1]) {
s.push({0, a[0] / a[1]});
a[0] %= a[1];
} else {
s.push({1, a[1] / a[0]}... |
Xi-Plus/OJ-Code | LeetCode/leetcode 1304.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
class Solution {
public:
vector<int> sumZero(int n) {
vector<int> ans;
if (n & 1) {
ans.push_back(0);
}
for (int q = 1; q <= n / 2; q++) {
ans.push_back(q);
ans.push_back(-q);
}
return ans;
}
};
int main() {
// ios::sync_with_s... |
Xi-Plus/OJ-Code | TOJ/toj 625.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, k, v[200005];
cin >> t;
while (t--) {
cin >> n >> k;
v[1] = 1;
v[2] = 1;
for (int i = 3; i <= n; i++) {
v[i] = v[i - 1] * 2;
if (i >= k + 2) {
v[i] -= v[i - k - 1];
}
v[i] = (v[i]%10007+10007)%10007;
}
cout << v[n] << en... |
Xi-Plus/OJ-Code | ZJ/zj d336.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 t;
cin>>t;
string s;
while(t--){
cin>>s;
int sz=s.size();
int sum=0;
for(int q=0;q<sz;q++){
sum+=s[sz-q-1]*(q%2+1);
}
if(sum%3)cout<<"No"<<e... |
Xi-Plus/OJ-Code | TIOJ/tioj 1197.cpp | <gh_stars>0
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
#define Debug(A)
using namespace std;
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
int m,n;
cin>>m>>n;
vector<vector<int>>v[m+1];
int a,b;
while(cin>>a>>b){
Debug(clog<<"input "<<a<<" "<<b<<endl;)
for(int q=2;q<m;q++){
... |
Xi-Plus/OJ-Code | UVa/uva 10041.cpp | <filename>UVa/uva 10041.cpp
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int t, r, arr[505];
cin>>t;
while(t--) {
cin>>r;
for(int q=0; q<r; q++){
cin>>arr[q];
}
sort(arr, arr+r);
int pick=arr[r/2];
long long ans=0;
for(int q=... |
Xi-Plus/OJ-Code | TOJ/toj 182.cpp | <filename>TOJ/toj 182.cpp<gh_stars>0
#include <algorithm>
#include <iostream>
using namespace std;
int main(){
int t;
cin >> t;
long long int v[3];
while (t--){
for (int q = 0; q < 3; q++)cin >> v[q];
sort(v, v + 3);
if (v[0] == v[1] && v[1] == v[2])cout << "Equilateral_triangle"... |
Xi-Plus/OJ-Code | TOJ/toj 13.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
long long dp[100010];
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
int v,n,w,p;
while(cin>>v>>n){
memset(dp,0,sizeof(dp));
while(n--){
cin>>w>>p;
for(int q=w;q<=v;q++... |
Xi-Plus/OJ-Code | UVa/uva 993.cpp | <reponame>Xi-Plus/OJ-Code<filename>UVa/uva 993.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 t, n;
cin>>t;
while(t--) {
cin>>n;
if(n==1) {
cout<<1<<endl;
continue;
}
vector<int> v;
for(int q=9; q>=2; q--) {
... |
Xi-Plus/OJ-Code | TIOJ/tioj 1508.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
bool dp[10110];
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
int m,n;
cin>>m>>n;
while(m--){
int halfsum=0;
int v[n];
for(int q=0;q<n;q++){
cin>>v[q];
halfsum+=v[q];
}
if(halfsum%2){
cout<<"No"<<end... |
Xi-Plus/OJ-Code | TOJ/toj 622.cpp | <reponame>Xi-Plus/OJ-Code<filename>TOJ/toj 622.cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
int t, n, w;
cin >> t;
for (int q = 0; q < t; q++) {
cout << "Case " << q + 1 << ":" << endl;
cin >> n;
w = (n + 1) / 2 * 2 + 1;
for (int i = 1; i <= n; i++) {
for (int j = 0; j < (i + 1) / 2; j++... |
Xi-Plus/OJ-Code | TIOJ/tioj 1754.cpp | <gh_stars>0
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int n,m,k;
long long dp[1010][1010];
const long long mod=1000000007;
long long dfs(int step,int x_step,bool start){
if(dp[step][x_step]!=-1) return dp[step][x_step];
if(step<=x_step) return 0;
if(step==1){
if(x_step==... |
Xi-Plus/OJ-Code | UVa/uva 151.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
bool v[105];
while(cin>>n, n){
int m=0;
while(true){
m++;
memset(v, 0, sizeof(v));
v[0]=1;
int remain=n-2, i=0;
while(remain){
for(int q=0; q<m;){
i++;
i%=n;... |
Xi-Plus/OJ-Code | UVa/uva 10221.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long s, a;
string mode;
cout<<fixed<<setprecision(6);
while(cin>>s>>a>>mode){
if(mode=="deg"){
a%=360;
if(a>=180) {
a=360-a;
}
cout<<2*(6440+s)*atan(1)*4*a/360<<" "
<<sq... |
Xi-Plus/OJ-Code | NTHUOJ/nthuoj 7354.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 n;cin>>n;
long long v[n+1];v[0]=0;
for(int q=1;q<=n;q++){
cin>>v[q];
v[q]^=v[q-1];
}
long long ans=0,ansl,ansr,t;
for(int q=1;q<=n;q++){
... |
Xi-Plus/OJ-Code | LeetCode/leetcode 678.cpp | <gh_stars>0
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
/*
"" => 0
"*" => 1
"**" => 2
"*(" => 1, 0
"*(*" => 1, 1
"*(**" => 1, 2
"*(*(" => 1, 1, 0
*/
class Solution {
public:
bool checkValidString(string s) {
vector<int> cnt;
int idx = 0;
cnt.push_back(0);
for (int q = 0; q < s.size();... |
Xi-Plus/OJ-Code | TIOJ/tioj 1753.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
vector<int> v;
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
long long n;cin>>n;
int a,b;
for(int q=0;q<n;q++){
cin>>a>>b;
v.push_back(a);
}
sort(v.begin(),v.end());
v.push_back(-2147483647);
long long lastnum=2147... |
Xi-Plus/OJ-Code | TOJ/toj 103.cpp | #include <iostream>
using namespace std;
int main() {
string a, b, c, d;
cin >> a >> c >> b >> d;
if (a == b && c == d) {
cout << "GOOD" << endl;
} else if (a != b && c != d) {
cout << "OTZ" << endl;
} else {
cout << "=~=" << endl;
}
} |
Xi-Plus/OJ-Code | ZJ/zj d475.cpp | <reponame>Xi-Plus/OJ-Code
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
long long power(long long a,long long b){
if(b==1) return a;
if(b&1) return power(a,b/2)*power(a,b/2)*a;
else return power(a,b/2)*power(a,b/2);
}
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);... |
Xi-Plus/OJ-Code | TOJ/toj 155.cpp | #include <iostream>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n,m;
cin>>n>>m;
string s1,s2;
cin>>s1>>s2;
for(int q=0;q<n;q++){
char a,b;
if(s1[q]<='9'&&s1[q]>='0')a=s1[q]-'0';
else a=s1[q]-'A'+10;
i... |
Xi-Plus/OJ-Code | TOJ/toj 468.cpp | <filename>TOJ/toj 468.cpp
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
// ios::sync_with_stdio(false);
// cin.tie(0);
int n, k;
cin>>n>>k;
char format[100];
sprintf(format, "%%.%df%%%%\n", k);
int v[n];
for(int q=0; q<n; q++){
cin>>v[q];
}
sort(v, v+n);
int m;
cin>>m;
int p,... |
Xi-Plus/OJ-Code | TOJ/toj 586.cpp | <filename>TOJ/toj 586.cpp
#include <bits/stdc++.h>
using namespace std;
int main() {
for (int i = 0; i < 5; i++) {
cout << "Hi" << endl;
}
}
|
Xi-Plus/OJ-Code | TOJ/toj 121.cpp | <reponame>Xi-Plus/OJ-Code
//#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
//#inc... |
Xi-Plus/OJ-Code | TIOJ/tioj 1621.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 n;
vector<int> v;
cin>>n;
int a,b;
int ans=0;
for(int q=0;q<n;q++){
cin>>a>>b;
while(!v.empty()&&v.back()>b){
v.pop_back();
}
if... |
Xi-Plus/OJ-Code | CF/cf 625A.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);
long long n,a,b,c;
cin>>n>>a>>b>>c;
long long ans=0;
if(n>=b&&b-c<a){
ans+=(n-b)/(b-c)+1;
n-=ans*(b-c);
}
ans+=n/a;
cout<<ans<<endl;
}
|
Xi-Plus/OJ-Code | TOJ/toj 117.cpp | #include <iostream>
using namespace std;
int main(){
int t;
int a,max=0;
cin>>t;
while(t--){
cin>>a;
if(a>max)max=a;
}
cout<<max<<endl;
} |
Xi-Plus/OJ-Code | TOJ/toj 109.cpp | #include <iostream>
using namespace std;
int main(){
int n,a,b,k=0;
cin>>n;
while(n--){
cin>>a>>b;
if(a==0&&b==2)k++;
else if(a==2&&b==5)k++;
else if(a==5&&b==0)k++;
else if(a==2&&b==0)k--;
else if(a==5&&b==2)k--;
else if(a==0&&b==5)k--;
}
if(k... |
Xi-Plus/OJ-Code | TOJ/toj 197.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 304.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,a;
char c;
cin>>n;
c=getchar();
c=getchar();
n--;
cin>>a;
cout<<a;
while(n--){
cin>>a;
cout<<c<<a;
}
co... |
Xi-Plus/OJ-Code | UVa/uva 10222.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
string t;
map<char, char> book;
t="qwertyuiop[]\\";
for(int q=t.size()-1; q>=2; q--){
book[t[q]] = t[q-2];
}
t="asdfghjkl;'";
for(int q=t.size()-1; q>=2; q--){
book[t[q]] = t[q-2];
}
t="z... |
Xi-Plus/OJ-Code | TOJ/toj 217.cpp | <filename>TOJ/toj 217.cpp
#include<cstdio>
using namespace std;
int main()
{
const int mod=1000000007;
int C[100001];
C[0]=2;
C[1]=2;
for(int q=2;q<=100000;q++){
if(q%2)C[q]=C[q-1];
else C[q]=C[q-1]+C[q/2-1];
if(C[q]>=mod)C[q]%=mod;
}
int B[100001];
B[1]=4;
fo... |
Xi-Plus/OJ-Code | LeetCode/leetcode 7.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int reverse(int x) {
long long x2 = x;
string n = "";
if (x2 < 0) {
n = "-";
x2 = -x2;
}
string s = to_string(x2);
std::reverse(s.begin(), s.end());
long long ans = stoll(n + s);
if (ans < -2147483648LL || ans > 2147483647... |
Xi-Plus/OJ-Code | ZJ/zj d549.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 double a,b,c;
while(cin>>a>>b>>c){
cout<<fixed<<setprecision(2)<<sqrt(a*a-b*b+c*c)<<endl;
}
}
|
Xi-Plus/OJ-Code | TIOJ/tioj 1195.cpp | <reponame>Xi-Plus/OJ-Code<filename>TIOJ/tioj 1195.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;
string s;
long long ans=0;
cin>>n;
while(n--){
cin>>s;
bool a=s[2]==s[3];
bool b=s[3]==s[4];
bool c=s... |
Xi-Plus/OJ-Code | UVa/uva 11005.cpp | <reponame>Xi-Plus/OJ-Code
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int cost[36];
vector<int> anslist;
int mincost;
void calc(int n, int m){
int ans=0;
if(n==0){
ans=cost[0];
}else{
while(n){
ans+=cost[n%m];
n/=m;
}
}
if(ans<mincost){
anslist.clear();
anslist.push_back(m);
m... |
Xi-Plus/OJ-Code | UVa/uva 10420.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin>>n;
string s;
set<string> country;
map<string, int> cnt;
while(n--){
cin>>s;
country.insert(s);
cnt[s]++;
getline(cin, s);
}
vector<string> v(country.begin(), country.end())... |
Xi-Plus/OJ-Code | ZJ/zj b798.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);
srand(time(NULL));
int a,b,c,d;
cin>>a>>b>>c>>d;
if(d>500)cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
|
Xi-Plus/OJ-Code | UVa/uva 12442/uva 12442.cpp | // By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct Node{
int son,ans,from;
bool leader,visit;
}node[50010];
int anslen,ansleader;
void dfs(int p){
node[p].visit=true;
if(node[p].from==node[node[p].son].from){
if(node[p].ans>anslen){
anslen=node[p].ans;
ansleader=nod... |
Xi-Plus/OJ-Code | TOJ/toj 101.cpp | <filename>TOJ/toj 101.cpp<gh_stars>0
#include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
cout<<(char)('A'+n-1)<<endl;
} |
Xi-Plus/OJ-Code | UVa/uva 12096.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T, N;
string s;
cin>>T;
while(T--){
cin>>N;
stack<set<int>> st;
int setidcnt=0;
map<set<int>, int> setid;
while(N--){
cin>>s;
set<int> temp, temp1, temp2, temp3;
switch(s[0]... |
Xi-Plus/OJ-Code | UVa/uva 122.cpp | <reponame>Xi-Plus/OJ-Code
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct Node{
int parent,left,right,value;
bool valid;
};
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
char c;
while(cin>>c){
// cout<<"input:"<<c<<endl;
vector<Node>node;
node.push_ba... |
Xi-Plus/OJ-Code | TOJ/toj 163.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
string s;
while(t--){
cin>>s;
bool x[16]={0};
x[3]=s[0]-'0';
x[5]=s[1]-'0';
x[6]=s[2]-'0';
x[7]=s[3]-'0';
x[9]=s[4]-'0';
x[10]=s[5]-'0';
x[... |
Xi-Plus/OJ-Code | UVa/uva 11321.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int m;
bool cmp(int a, int b){
if(a%m==b%m){
if((a&1)+(b&1)!=1){
if(a&1){
return a>b;
}else{
return a<b;
}
}
return (a&1)>(b&1);
}
return a%m<b%m;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, arr[10005];
whil... |
Xi-Plus/OJ-Code | TIOJ/tioj 1506.cpp | <reponame>Xi-Plus/OJ-Code<gh_stars>0
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct Multiple{
double x,y;
};
Multiple Cramer(double a,double b,double c,double d,double e,double f){
// ax+by=e
// cx+dy=f
// https://zh.wikipedia.org/wiki/%E5%85%8B%E8%90%8A%E5%A7%86%E6%B3%... |
Xi-Plus/OJ-Code | ZJ/zj a242.cpp | <filename>ZJ/zj a242.cpp
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
struct T{
long long a,x,b,cnt;
};
bool cmp(T v1,T v2){
return v1.x<v2.x;
}
bool cmp2(T v1,long long n){
return v1.cnt<n;
}
int main(){
// ios::sync_with_stdio(false);
// cin.tie(0);
int t;
cin>>t;
while(... |
Xi-Plus/OJ-Code | UVa/uva 10268.cpp | #include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
long long x, n, a, t;
string s;
while(cin>>x){
cin.ignore();
getline(cin, s);
stringstream ss(s);
vector<long long> a;
n=-1;
while(ss>>t){
a.push_back(t);
n++;
}
for(int q=0; ... |
Xi-Plus/OJ-Code | CF/cf 877C.cpp | <reponame>Xi-Plus/OJ-Code<gh_stars>0
#include<iostream>
using namespace std;
int main() {
int n;
cin>>n;
cout<<n/2*2+(n+1)/2<<endl;
for(int q=2; q<=n; q+=2) {
cout<<q<<" ";
}
for(int q=1; q<=n; q+=2) {
cout<<q<<" ";
}
for(int q=2; q<=n; q+=2) {
cout<<q<<" ";
}
cout<<endl;
}
|
Xi-Plus/OJ-Code | TOJ/toj 15.cpp | <filename>TOJ/toj 15.cpp
// By KRT girl xiplus
#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int name2p(string s){
if(s=="elder")return 1;
if(s=="nursy")return 2;
if(s=="kit")return 3;
if(s=="warrior")return 4;
if(s=="appentice")return 5;
if(s=="medicent")return 6;
if(s=="d... |
Xi-Plus/OJ-Code | TOJ/toj 122.cpp | <filename>TOJ/toj 122.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
//#inc... |
Xi-Plus/OJ-Code | paiza-poh-ando/ando13/C++.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
long long ans=1;
while(n){
ans*=n;
while(ans%10==0)ans/=10;
ans%=1000000000000;
n--;
}
cout<<ans%1000000000;
}
|
Xi-Plus/OJ-Code | TOJ/toj 67.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;
while(getline(cin,s)){
long long int ans=0;
string a;
stringstream t(s);
while(t>>a){
if(a.find("/")==string::npos){
a... |
Xi-Plus/OJ-Code | paiza-poh-ando/ando7/C++.cpp | <reponame>Xi-Plus/OJ-Code
#include <iostream>
using namespace std;
int main(){
int c1,p1,c2,p2;
cin>>c1>>p1>>c2>>p2;
if(c1*p2>c2*p1) cout<<1;
else cout<<2;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.