This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BigInt::QuRem BigInt::div(const BigInt & d) const | |
| { | |
| if (d.isNull()) { | |
| throw BigIntDivideByZeroException(); | |
| } | |
| if (this->isNull()) { | |
| return (QuRem)std::make_pair(0, 0); | |
| } | |
| auto R = this->abs(), B = d.abs(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (g[u].size() <= 1 || g[v].size() <= 1 || | |
| g[b.first].size() <= 1 || g[b.second].size() <= 1 || | |
| (u == b.first || u == b.second) && g[u].size() <= 2 || | |
| (v == b.first || v == b.second) && g[v].size() <= 2); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| unsigned int findBestWay() { | |
| unsigned int be4last = N; | |
| for(int i=0; i < N; ++i) | |
| bestWay[i].resize(N); | |
| for (unsigned int i = 0; i < N; i++) { | |
| for (unsigned int k = 0; k < N; k++) | |
| for (unsigned int j = 0; j < N; j++) { | |
| int res = G[ans[i]][ans[k]] * G[ans[k]][ans[j]] / 10000; | |
| if (G[ans[i]][ans[j]] < res) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void dijkstra() { | |
| //Dijkstra initialization | |
| vector<vector<double>> d(i_num, vector<double>(i_num, INF)); | |
| vector<vector<bool>> used(i_num, vector<bool>(i_num)); | |
| vector<int> pred(i_num); | |
| priority_queue<Vertex> q; | |
| // Dijkstra (modified) | |
| //d[snum] = 0; | |
| for (auto e : g[snum]) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include "pt4.h" | |
| #include "mpi.h" | |
| #include <ctime> | |
| #include <cmath> | |
| #define gravity 10 // гравитационная постоянная | |
| #define dt 0.1 // шаг по времени | |
| #define N 800 // количество частиц | |
| #define fmax 1 // максимальное значение силы | |
| #define Niter 100 // число итераций |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var | |
| b, c: array [0..1999] of shortint; | |
| r, n, s, i, j, x, bj, bp, ap, app: integer; | |
| function max(a, b: integer): integer; | |
| begin | |
| if a > b then | |
| max := a | |
| else | |
| max := b; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| procedure maxi(var a: integer; b: integer); | |
| begin | |
| if a < b then | |
| a := b | |
| end; | |
| procedure readNext(var s: string; var i: integer; var n: integer); | |
| const | |
| ord0: integer = 48; | |
| begin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| procedure maxi(var a: integer; b: integer); | |
| begin | |
| if a < b then | |
| a := b | |
| end; | |
| begin | |
| var b, c: array [0..1999] of shortint; | |
| var r, n, x, bj, bp, ap, app, s1, s2: integer; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ABCDEFGHIJ | |
| ACHH | |
| ACHA | |
| ACGJ | |
| ACGB | |
| ADJA | |
| ADJD | |
| ADIE | |
| ADIC | |
| BEAI |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| procedure printSet<T>(s: SortedSet<T>); | |
| begin | |
| foreach e: T in s do | |
| begin | |
| Print(e); | |
| Print(' '); | |
| end; | |
| Println(); | |
| end; | |
OlderNewer