Skip to content

Commit

Permalink
guia atualizado
Browse files Browse the repository at this point in the history
  • Loading branch information
aajjbb committed Jun 17, 2014
1 parent 5d24f7e commit f411962
Show file tree
Hide file tree
Showing 9 changed files with 6,557 additions and 1,269 deletions.
1,182 changes: 520 additions & 662 deletions Guia De Referencia - MaratonaFINAL.txt

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions LiveArchive/.#SometimesPenaltyIsGood.cpp
22 changes: 22 additions & 0 deletions LiveArchive/SometimesPenaltyIsGood.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#include <bits/stdc++.h>

template<typename T> T gcd(T a, T b) {
if(!b) return a;
return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned uint;

int main(void) {
return 0;
}
63 changes: 63 additions & 0 deletions LiveArchive/SumTheSquare.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include <bits/stdc++.h>

template<typename T> T gcd(T a, T b) {
if(!b) return a;
return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned uint;

int A, B;

vector<Int> seq(int x) {
vector<Int> ans;
ans.push_back(x);
set<Int> mark;
mark.insert(x);

for ( ; ; ) {
Int n = 0LL;
while (x > 0LL) {
int d = (x % 10LL);
x /= 10LL;
n += d * d;
}
if (mark.count(n)) {
break;
} else {
x = n;
ans.push_back(n);
mark.insert(n);
}
}

return ans;
}

int main(void) {
for ( ; scanf("%d%d", &A, &B) && A + B != 0; ) {
vector<Int> sa = seq(A), sb = seq(B);
int ans = 1010100;

for (int i = 0; i < (int) sa.size(); i++) {
for (int j = 0; j < (int) sb.size(); j++) {
if (sa[i] == sb[j]) {
ans = min(ans, i + j + 2);
}
}
}
if (ans == 1010100) ans = 0;
printf("%d %d %d\n", A, B, ans);
}
return 0;
}
33 changes: 33 additions & 0 deletions LiveArchive/WhatsNext.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <bits/stdc++.h>

template<typename T> T gcd(T a, T b) {
if(!b) return a;
return gcd(b, a % b);
}
template<typename T> T lcm(T a, T b) {
return a * b / gcd(a, b);
}

template<typename T> void chmin(T& a, T b) { a = (a > b) ? b : a; }
template<typename T> void chmax(T& a, T b) { a = (a < b) ? b : a; }
int in() { int x; scanf("%d", &x); return x; }

using namespace std;

typedef long long Int;
typedef unsigned uint;

int A, B, C;

int main(void) {
for ( ; scanf("%d%d%d", &A, &B, &C) == 3 && !(A == 0 && B == 0 && C == 0); ) {
int da = B - A, db = C - B;

if (da == db) {
printf("AP %lld\n", (Int) C + da);
} else if (B * (B / A) == C) {
printf("GP %lld\n", (Int) C * (Int) (C / B));
}
}
return 0;
}
Binary file modified LiveArchive/a.out
Binary file not shown.
Loading

0 comments on commit f411962

Please sign in to comment.