SPOJ MEOWIST

The Problem
This problem should be a practise problem
It took me 20mins to solve it =) , I am too rusted lately but hopefully I will post a new problem everyday from now on

#include<stdio.h>
#include<stdlib.h>
#include<algorithm>
#include<string>
#include<iostream>
#include<set>

using namespace std;

class person{
public:
int age;
[...]

Solution for SPOJ PLD Palindromes

This problem is one of the best problems i solved because my solution is not %100 correct but its probability to solve the problem correctly is very near to 100 percent
The problem asks to count all palindromes of length k on a string of length n Since k,n

K length Palindromes in a String Solution Idea

The problem: https://www.spoj.pl/problems/PLD/
With rabin karp hash all string of K/2 length,
Then if there is a hash value collision search for the start of the current string being searched, if it is the end of another string increment
Hash structure is a binary tree

SHOCALC

Try writing a c code without “;” and “!”
http://www.spoj.pl/problems/SHOCALC/
It is an extremely fun problem
Here is my solution:

main(int a,int b,int c){while(scanf("%d%d%d",&a,&b,&c)>0){if(a=a<3?a<2?b+c:b-c:a>4?b%c:a>3?b/c:b*c,printf("%d\n",a)){}}}

Only problem is i couldn’t return 0, or exit(0) without a “;”, it turns out that the problem setter didn’t check “;” condition
so if you add an exit(“0”); it will pass
EDIT:
Here is the last [...]

Halloween treats

https://www.spoj.pl/problems/HALLOW/
Solution:
Problem H: Halloween treats
This problem probably would have been easier given following hint: There always exists a solution with a selection of consecutive neighbours. The reason why this is true follows from the fact that c ≤ n, using the pigeonhole principle.
Let us define partial sums Si as the sum of the first i values [...]