eolymp
Задачи

Уборка территории

опубликовано 23.02.2010, 13:55:31

http://www.e-olimp.com/solutions/54726 I forgot read to A and B but my program passed 53.3%??

опубликовано 23.02.2010, 14:49:56

> victor > http://www.e-olimp.com/solutions/54726 > > I forgot read to A and B but my program passed 53.3%?? You want to know why your invalid program sometimes gives the correct results?

опубликовано 23.02.2010, 15:02:29

> MrMozg > You want to know why your invalid program sometimes gives the correct results? Of course

опубликовано 23.02.2010, 17:20:28

> victor > Of course You know exactly what the initial value will assign a variable the compiler? It would be surprising if the program has given 100% result, there is nothing surprising - rand() is also sometimes gives the correct result.

awpris ответил:
Especially when the work is not specific tests, and randomly generated system ... :)
опубликовано 06.12.2021, 12:01:31

include <iostream>

using namespace std;

int gcd(int a, int b) { while (b) { a %= b; swap(a, b); } return a; }

int main() { int n, m; cin >> n >> m; if (n == 1 || m == 1) cout << 1 << endl; else cout << gcd(n, m) << endl; }

опубликовано 06.12.2021, 12:02:42

це габела

опубликовано 06.12.2021, 12:02:44

це габела

опубликовано 06.12.2021, 12:02:44

це габела

опубликовано 06.12.2021, 12:02:47

pRIVET

опубликовано 06.12.2021, 12:03:04

1000-7

опубликовано 06.12.2021, 12:04:55

darov

опубликовано 06.12.2021, 12:05:32

include <iostream>

using namespace std;

int gcd(int a, int b) { while (b) { a %= b; swap(a, b); } return a; }

int main() {

опубликовано 06.12.2021, 12:05:36

бабл квас