-
Posts
79 -
Joined
-
Last visited
-
Days Won
12
Community Answers
-
Anza Power's post in building a bridge was marked as the answer
You might've misunderstood me a little bit, I should have detailed a bit more, let the river be of width 1 unit, align the axis such that the x axis is parallel with and centered the river, in other words the river would be the area -0.5<y<0.5, now "removing" the river means collapsing it and so every point that was below it now goes up by 0.5 units and every point above it goes doen 0.5 units...
-
Anza Power's post in Sharing a sandwhich was marked as the answer
You mean show that for any shape there exists a direction such that if you slice through it you get two equal halves?
-
Anza Power's post in Lychrel was marked as the answer
Code:
#include <iostream> #define BUF_SIZE 100 using namespace std; void putInArray(int num, int* buf){ for(int i=0;i<BUF_SIZE;i++){ buf[i] = num % 10; num = num / 10; } } bool isPalindrom(int* buf){ int i=0, j=BUF_SIZE-1; while(buf[j]==0 && j>0){ j--; } while(i<j){ if(buf[i] != buf[j]){ return false; } i++; j--; } return true; } void applyIteration(int* buf){ int i=0, j=BUF_SIZE-1; while(buf[j]==0 && j>0){ j--; } while(i<=j){ int temp = buf[i] + buf[j]; buf[i++] = temp; buf[j--] = temp; } for(int i=0;i<BUF_SIZE-1;i++){ buf[i+1] += buf[i] / 10; buf[i] = buf[i] % 10; } } bool isLychrel(int* buf){ for(int i=1;i<50;i++){ applyIteration(buf); if(isPalindrom(buf)){ return false; } } return true; } int main() { int buf[BUF_SIZE]; for(int num=0;num<10000;num++){ putInArray(num,buf); if(isLychrel(buf)){ cout << num << " is Lychrel " << endl; } } } -
Anza Power's post in Amoeba evacuation puzzle was marked as the answer
Yeah I think that is correct, here's why:
-
Anza Power's post in The traveling ant was marked as the answer
I think your first sentence is wrong
But you can put it another way: