Search found 2 matches

by zuo
Thu Apr 01, 2010 2:21 pm
Forum: Challenges Solved
Topic: Valuation
Replies: 103
Views: 8906

#include<iostream> #include<string.h> using namespace std; int main() { char s[1000] = "93752xxx746x27x1754xx90x93xxxxx238x44x75xx08750912738x8461x8759383xx328x4x4935903x6x5550360535004x0xx945958961296x267x8842xxx5x6xx61x4x48482x80xxx83316843x7x4x83x9521731xxx25x51xx457x6x5x9698222x771237745034...
by zuo
Thu Apr 01, 2010 1:41 pm
Forum: Challenges Solved
Topic: UpCount
Replies: 28
Views: 2433

public static void main(String[] args) { long[] d = new long[11590]; d[0] = 1; for (int i = 1; i <= 11589; i++) { d = d[i-1] + (i % 7) + ((((d[i-1] ^ i) & 3) == 0) ? 1 : 0); } System.out.println(d[11589]); } simply do a memorization and use bitwise operation to do modulo