Amaliy matematika va informatika fakulteti axborotlashtirish kafedrasi algoritmlash asoslari fanidan
Download 1.11 Mb.
|
Kriptografiya va kambinatorika masalalari.
Ilovalar
Vinejer usulika kodlangan dasturning ko’rinishi Uses crt; var a1: array [1..5] of integer; a,s,s1:string; k,m,i,j,n,n1:integer; begin
a:='abcdefghijklmnopqrstuvwxyz'; write('shifrlanishi kerak matnni kiriting='); readln(s); write('kalit so`zni kiriting ='); readln(s1); n:=length(s1); n1:=length(s); for i:=1 to n do for j:=1 to 26 do if s1[i]=a[j] then begin a1[i]:=j; break end; if n1 mod n <>0 then write('shifrlanayotgan matn uzunligi kalit so`z uzunligiga karrali emas') else begin
for i:=1 to n1 do begin
for j:=1 to 26 do if s[i]=a[j] then begin m:=j; break end; k:=i mod n; if k=0 then k:=n; k:=a1[k]+m-1; if k>26
then k:=k-26; s[i]:=a[k]; end; writeln(s); for i:=1 to n1 do begin
for j:=1 to 26 do if s[i]=a[j] then begin m:=j; break end; k:=i mod n; if k=0 then k:=n; k:=1-a1[k]+m; if k<0 then k:=k+26; s[i]:=a[k]; end;
write(s); end;
end.
#include #include using namespace std; int main(){ double a, y; cin >> a; if (a > 2) printf("4.00"); if (a <= 2 && a >= -1) printf("%.2f", a * a); if (a < -1) printf("%.2f", 1 / (a * a)); }
#include #include using namespace std; int main(){ float a, y; cin >> a; if (a <= 0) y = -a; if (a > 0 && a <= 1) y = a; if (a > 1 && a <= 2) y = 1; if (a > 2) y = (2.5 - a) * 2; cout << setprecision(2) << fixed << y; return 0; }
#include #include using namespace std; int main(){ float a, y; cin >> a; if (a == 0) y = 1; if (a > 0 && a <= 1) y = (1 - a); if (a < 0 && a >= -1) y = (1 + a); if (a > 1) y = (a - 1); if (a < -1) y = -1 * (a + 1); cout << setprecision(2) << fixed << y; return 0; }
#include using namespace std; int main() { float x, y; cin >> x >> y; if (y + 3 * x <= 2 && y - 3 * x <= 2 && y >= -1){ cout << "yes"; } else cout << "no"; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (y >= -2 && x <= 1 && x >= -1 && y <= fabs(x)){ cout << "yes"; } else cout << "no"; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (x >= -2 && x <= 2 && y <= 1.5 && y >= 1 || y >= fabs(x) && y <= 1.5){ cout << "yes"; } else cout << "no"; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (y >= 0 && x * x + y * y <= 4 && x * x + y * y >= 1){ cout << "yes"; } else cout << "no"; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (x * x + y * y > 1) cout << "no"; else cout << "yes"; return 0; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (x > 1 || y > 1 || x < -1 || y < -1) cout << "no"; else cout << "yes"; return 0; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (y <= x / 2 && x * x + y * y <= 1){ cout << "yes"; } else cout << "no"; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (-2*x+1>=y && 2*x+1>=y && -2*x-1<=y && 2*y-1<=y){ cout << "yes"; } else cout << "no"; }
#include #include using namespace std; int main(){ float x, y; cin >> x >> y; if (x/2-1<=y && -x/2+1>=y && x*x+y*y<=1){ cout << "yes"; } else cout << "no"; }
#include #include #include using namespace std; int main() { int n; float s = 0; cin >> n; for (int i = 1; i <= n; i++) { s = s + sin(i) / pow(2, i); } cout << setprecision(2) << fixed << s; return 0; }
#include #include #include using namespace std; float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } int main(){ int n; float s = 0; cin >> n; for (int i = 1; i <= n; i++){ s = s + pow(-1, i + 1) * (1.0 * 1 / fac((2 * i - 1))); } cout << setprecision(4) << fixed << s; }
#include #include #include using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 1; i <= n; i++){ s = s + pow(-1, i - 1) / pow(x, 2 * i); } cout << setprecision(3) << fixed << s; }
#include #include #include using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 1; i <= n; i++){ s = s + i / pow(x, 2 * i); } cout << setprecision(3) << fixed << s; }
#include #include #include using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 1; i <= n; i++){ s = s + pow(-1, i - 1) / i * sin(i * x); } cout << setprecision(3) << fixed << s; }
#include #include #include float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 1; i <= n; i++){ s = s + pow(x, i) / fac(i); } cout << setprecision(3) << fixed << s; }
#include #include #include __int64 P(int a, int n){ int p = 1; for (int i = 1; i <= n; i++){ p = p * a; } return p; } using namespace std; int main(){ int n, x; cin >> n >> x; double s = 0; for (int i = 1; i <= n; i++){ s = s + P(x, i) / sqrt(i); } cout << setprecision(3) << fixed << s; }
#include #include #include float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 1; i <= n; i++){ s = s + pow(-1, i) * pow(x, i) / fac(i); } cout << setprecision(3) << fixed << s; }
#include #include #include float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 1; i <= n; i++){ s = s + pow(-1, i + 1) * pow(x, (2 * i - 1)) / fac(2 * i - 1); } cout << setprecision(3) << fixed << s; }
#include #include #include float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 0; i < n; i++){ s = s + pow(-1, i) * pow(x, (2 * i)) / fac(2 * i); } cout << setprecision(3) << fixed << s; }
#include #include #include float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } using namespace std; int main(){ int n, x; cin >> n >> x; float s = 0; for (int i = 0; i < n; i++){ s = s + pow(x, (2 * i)) / fac(2 * i); } cout << setprecision(3) << fixed << s; }
#include #include #include using namespace std; int main(){ int n, x; cin >> n >> x; double s = 0; for (int i = 1; i <= n; i++){ s = s + pow(x, (2 * i - 1)) / (2 * i - 1); } cout << setprecision(3) << fixed << s; }
#include #include #include using namespace std; float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } int main(){ int n, x; cin >> n >> x; double s = 0; for (int i = 1; i <= n; i++){ s = s + pow(x, (2 * i - 1)) / fac(2 * i - 1); } cout << setprecision(3) << fixed << s; }
#include #include #include using namespace std; float fac(int n){ if (n == 0) return 1; if (n == 1) return 1; return n * fac(n - 1); } int main(){ int n, x; cin >> n >> x; double s = 0; for (int i = 0; i <= n; i++){ s = s + pow(-1, i) * pow(x, i) / fac(i); } cout << setprecision(3) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; double s = 0; for (int i = a; i <= c; i+=3){ s = s + pow((a * i + b) / (b * b + pow(cos(i), 2)), 1.0 * 1 / 3) - sin(i * i) / (a * b); } cout << setprecision(2) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c, d; cin >> a >> b >> c >> d; double s = 0; for (int i = c; i <= d; i+=2){ s = s + pow((sin(a * i) + pow(b, 2 * c)) / (b * b + pow(cos(i), 2)), 1.0 * 1 / 3) - sin(i * i) / (a * b); } cout << setprecision(2) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c; double s = 0; cin >> a >> b >> c; for (int i = a; i <= b; i += 2){ s = s + (pow(a, b) + pow(b, i) + pow(c, a)) / (2 * i * i + 3 * pow(a, i)); } cout << setprecision(2) << fixed << s; }Summani xisoblang Описание: C:\wamp\www\079_1.files\image001.png, Описание: C:\wamp\www\079_1.files\image002.png Bu yerda x – π/2 va π oralig’ida, h sikl qadami Kiruvchi ma’lumotlar: a butun son (1<=a <=20); Chiquvchi ma’lumotlar: y – masala yechimi 10-2 aniqlikda chiqarilsin. Kiruvchi ma’lumotlar Chiquvchi ma’lumotlar 2 49.46 3 78.40#include #include #include using namespace std; int main(){ int a; cin >> a; double s = 0; for (double i = -3.1415926535 / 2; i <= 3.1415926535; i += 3.1415926535/19){ s = s + pow(a, 1.0*a/3) + i*i*cos(a*i); } cout << setprecision(2) << fixed << s; }Summani xisoblang , Bu yerda x – 0 va 10 oralig’ida, h sikl qadami Kiruvchi ma’lumotlar: a butun son (0<=a<=100); Chiquvchi ma’lumotlar: y – masala yechimi 10-2 aniqlikda chiqarilsin Kiruvchi ma’lumotlar Chiquvchi ma’lumotlar 1 0.87
3 -1.10#include #include #include using namespace std; int main(){ int a; cin >> a; double s = 0; for (double i = 0; i <= 10; i += 0.5){ s = s + a*cos(i)-sin(i*i); } cout << setprecision(2) << fixed << s; } Summani xisoblang Описание: Описание: \\172.20.27.98\www\081_1.files\image001.png, Описание: Описание: \\172.20.27.98\www\081_1.files\image002.png Bu yerda x – 1 va 12 oralig’ida, h sikl qadami Kiruvchi ma’lumotlar: a, b butun son (0<=a,b<=100); Chiquvchi ma’lumotlar: y – masala yechimi 10-2 aniqlikda chiqarilsin. Kiruvchi ma’lumotlar Chiquvchi ma’lumotlar 3 2 57.51
5 4 153.01
#include #include #include using namespace std; int main(){ int a, b; cin >> a >> b; double s = 0; for (double i = 1; i <= 12; i += 2){ s = s + a*a+pow((b+sin(i))/(a*a*a+cos(i*i*i)*cos(i*i*i)), 1.0*1/5); } cout << setprecision(2) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; double s = 0; for (double i = 1; i <= 10; i += 3){ s = s + a*i*i/b+i/c; } cout << setprecision(2) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; double s = 0; for (double i = 5; i <= 10; i += 0.5){ s = s + (a*a+b*i+pow(i,c))/(a*a+b*b+i*i); } cout << setprecision(2) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; double s = 0; for (double i = -1; i <= 1; i += 0.25){ s = s + pow((sin(a*i)+pow(b,c))/(b*b+cos(i)*cos(i)),1.0*1/3)-sin(i*i)/(a*b); } cout << setprecision(2) << fixed << s; }
#include #include #include using namespace std; int main(){ int a, b, c; cin >> a >> b >> c; double s = 0; for (double i = 1; i <= 20; i += 5){ s = s + (a*i*i+b*i+c)/(a*a+b*b+i*i); } cout << setprecision(2) << fixed << s; }
Download 1.11 Mb. Do'stlaringiz bilan baham: |
ma'muriyatiga murojaat qiling