void main() { int i,b1=26,b2=26,k[52],p1[52],p2[52],p12,p22; srand((unsigned)time(NULL)); kart(k); for(i=0;i<26;i++) { p1[i]=k[i]; p2[i]=k[i+26]; } getchar(); do { i=0; system("clear"); rez(b1,b2); himikal(p1,p2,&p12,&p22,i); printf("\n"); getchar(); if(p1[i]-p12>p2[i]-p22) pe(p1,p2,&b1,&b2); else if(p1[i]-p12<p2[i]-p22) pd(p1,p2,&b1,&b2); else voina(p1,p2,&b1,&b2,&p12,&p22,i); } while((b1!=0)&&(b2!=0)); system("clear"); rez(b1,b2); if(b1==0) printf("\n\n POBEDITEL E PLAYER2!!!\n"); else printf("\n\n POBEDITEL E PLAYER1\n"); }
CSString CSString::number(double n) { char string[80]; sprintf(string, "%.2f", n); CSString rez(string); return rez; }
CSString CSString::number(int n, int base) { char string[80]; itoa(n, string, base); CSString rez(string); return rez; }
int main() { freopen("disjoint.in", "r", stdin); freopen("disjoint.out", "w", stdout); rez(); return 0; }
TEST(TVector, compare_vector_with_itself_return_true) { TVector<int> rez(6); rez[0] = 234; rez[2] = -54; rez[5] = 1; // 234 0 -54 0 0 1 EXPECT_EQ(1,rez == rez); }
std::vector<double> MDTransfNoQ::getExtremumPoints(const double xMin, const double xMax, size_t det_num) const { UNUSED_ARG(det_num); std::vector<double> rez(2); rez[0] = xMin; rez[1] = xMax; return rez; }
int main() { freopen("palm.in", "r", stdin); freopen("palm.out", "w", stdout); gets(s); n = strlen(s) - 1; rez(); return 0; }
int main() { freopen("cifre.in", "r", stdin); freopen("cifre.out", "w", stdout); scanf("%d%d%d%d", &a, &b, &c, &k); int total = b - a + 1; punevector(a, va); ++b; punevector(b, vb); dinamica1(); dinamica2(); int x = rez(vb) - rez(va); if (a == 0 && c == 0) ++x; printf("%.4lf", (double)x / total); return 0; }
TEST(TVector, copied_vector_is_equal_to_source_one) { TVector<int> v(10); v[3] = 3; v[4] = -3; TVector<int> v1(v); TVector<int> rez(10); rez[3] = 3; rez[4] = -3; EXPECT_EQ(rez, v1); }
int main() { freopen("nrperm.in", "r", stdin); freopen("nrperm.out", "w", stdout); citire(); make_perm(); make_pascal(); rez(); return 0; }
//----------------------------------------------------- void Medis::Isvesti(string Crez) { ofstream rez(Crez.c_str()); Pradzia(); rez << "/------------------------------------------------------------------------------------------------/" << endl; rez << left << setw(15) << "Pavardë" << left << setw(15) << "Vardas" << setw(10) << "Grupë" << setw(12) << "Metai" << setw(10) << "Lytis" << setw(16) << "Paþymiai" << setw(9) << "Vidurkis" << endl; rez << "/------------------------------------------------------------------------------------------------/" << endl; rez.close(); while (Yra()) { d->SpausdintiFakulteta(Crez); Kitas(); } rez.close(); }
CString Speller::GetFract(double d,int prec){ if(!prec)return ""; d-=floor(d); int i,j; LPTSTR ts; if(prec<0){ ts=fcvt(d,20,&i,&j); if('0'==*ts)return ""; for(LPTSTR tail=ts+19;ts<tail;tail--){ if('0' == *tail)*tail='\0'; //убираем конечные нули else break; //до 1-го ненулевого символа. } CString rez('0',i); rez+=ts; return rez; } d+=1; ts=fcvt(d,prec,&i,&j); CString rez(ts+1); return rez; }
//------------------------------------------------------------- void SarasuGrupe::Isvedimas(string Crez) { ofstream rez(Crez.c_str(), ios::app); Pradzia(); rez << "/------------------------------------------------------------------------------------------------/" << endl; rez << left << setw(15) << "Pavardë" << left << setw(15) << "Vardas" << setw(10) << "Grupë" << setw(12) << "Metai" << setw(10) << "Lytis" << setw(16) << "Paþymiai" << setw(9) << "Vidurkis" << right << setw(14) << "Fakultetas" << endl; rez << "/------------------------------------------------------------------------------------------------/" << endl; while (YraSarasas()) { rez << d->ImtiStudenta().SpausdintiEilute() << " " << d->ImtiStudenta().ImtiFakulteta() << endl; Kitas(); } rez << "/------------------------------------------------------------------------------------------------/" << endl; rez.close(); }
TEST(TVector, can_multiply_scalar_by_vector) { TVector<int> x(3,0); x[0] = 0; x[1] = 3; x[2] = -3; // 0 3 -3 x = x * 2; TVector<int> rez(3, 0); rez[0] = 0; rez[1] = 6; rez[2] = -6; // 0 6 -6 EXPECT_EQ(rez, x); }
TEST(TVector, can_add_scalar_to_vector) { TVector<int> x(6); x[0] = 10; x[2] = -10; x[5] = 1; // 10 0 -10 0 0 1 x = x + 5; TVector<int> rez(6); rez[0] = 15; rez[1] = 5; rez[2] = -5; rez[3] = 5; rez[4] = 5; rez[5] = 6; // 15 5 -5 5 6 5 EXPECT_EQ(rez, x); }
TEST(TVector, can_subtract_scalar_from_vector) { TVector<int> x(6); x[0] = 10; x[2] = -10; x[5] = 1; // 10 0 -10 0 1 0 x = x - 5; TVector<int> rez(6); rez[0] = 5; rez[1] = -5; rez[2] = -15; rez[3] = -5; rez[4] = -5; rez[5] = -4; // 5 -5 -15 -5 -4 -5 EXPECT_EQ(rez, x); }
TEST(TVector, can_assign_vectors_of_equal_size) { TVector<int> v(4); v[3] = 4; v[1] = 3; // 0 3 0 4 TVector<int> z(4); z[0] = -1; z[2] = -4; // -1 0 -4 0 v = z; TVector<int> rez(4); rez[0] = -1; rez[2] = -4; // -1 0 -4 0 EXPECT_EQ(rez, v); }
TEST(TVector, can_subtract_vectors_with_equal_size) { TVector<int> x(3, 1); x[1] = 3; x[2] = -3; // 0 3 -3 TVector<int> y(3, 1); y[1] = 6; y[2] = -6; // 0 6 -6 TVector<int> rez(3, 1); rez[1] = -3; rez[2] = 3; // 0 -3 3 EXPECT_EQ(rez, x - y); }
TEST(TVector, can_add_vectors_with_equal_size) { TVector<int> x(3, 1); x[1] = 3; x[2] = -3; // 0 3 -3 TVector<int> y(3, 1); y[1] = 6; y[2] = -6; // 0 6 -6 TVector<int> rez(3, 1); rez[1] = 9; rez[2] = -9; // 0 9 -9 EXPECT_EQ(rez, x + y); }
TEST(TVector, can_assign_vectors_of_different_size) { TVector<int> v(4); v[3] = 4; v[1] = 3; // 0 3 0 4 TVector<int> z(6); z[0] = 234; z[2] = -54; z[5] = 1; // 234 0 -54 0 0 1 v = z; TVector<int> rez(6); rez[0] = 234; rez[2] = -54; rez[5] = 1; // 234 0 -54 0 0 1 EXPECT_EQ(rez, v); }
/** method returns the vector of input coordinates values where the transformed *coordinates reach its extremum values in Q or dE * direction. * * @param eMin -- minimal momentum (in elastic mode) or energy transfer (in *inelastic) for the transformation * @param eMax -- maximal momentum (in elastic mode) or energy transfer (in *inelastic) for the transformation * @param det_num -- number of the instrument detector for the transformation */ std::vector<double> MDTransfModQ::getExtremumPoints(const double eMin, const double eMax, size_t det_num) const { std::vector<double> rez(2); switch (m_Emode) { case (Kernel::DeltaEMode::Elastic): { rez[0] = eMin; rez[1] = eMax; return rez; } case (Kernel::DeltaEMode::Direct): case (Kernel::DeltaEMode::Indirect): { double ei = m_Ei; if (m_pEfixedArray) ei = double(*(m_pEfixedArray + det_num)); double ez = (m_DetDirecton + det_num)->Z(); double eps_extr = ei * (1 - ez * ez); if (eps_extr > eMin && eps_extr < eMax) { rez.resize(3); rez[0] = eMin; rez[1] = eps_extr; rez[2] = eMax; } else { rez[0] = eMin; rez[1] = eMax; } return rez; } default: { throw std::invalid_argument( "Undefined or unsupported energy conversion mode "); } } return rez; }
draw_point shape_cd::get_delta_p ( int i ) const { draw_point rez ( qreal ( get_x ( i ) ), qreal ( get_y ( i ) ) ); return rez; }
std::string operator+(const libsentences::utf8_slice &a, const std::string &b) { std::string rez(a.ptr(), a.size()); rez.append(b); return std::move(rez); }
Mat COpenCVInterfaceDlg::InitImage(int rows, int cols) { //Mat rez(rows,cols,CV_8UC3,Scalar(0,0,0)); Mat rez(rows,cols,CV_8UC1,Scalar(0)); return rez; }