tag:blogger.com,1999:blog-31779429998387284732024-03-13T06:14:20.987-07:00This is Team "Hello World!" preparing for ACM ICPC 07-08 :)Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.comBlogger28125tag:blogger.com,1999:blog-3177942999838728473.post-35251255687803302862007-12-17T00:06:00.002-08:002007-12-17T00:25:24.753-08:00Sum of Consecutive Prime Numbers<pre><span style="font-weight: bold;font-size:130%;" >ACCEPTED</span><span><span style="font-size:130%;"> !!! An Opener again from Tokyo 2005/06</span></span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=3399"><span style="font-size:130%;">Sum of Consecutive Prime Numbers</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">int isprime[10001], ind[10001], primes[10001];<br /><br />int isPrime(int n) {<br /> int s = (int)sqrt(n);<br /> for(int i = 2; i <= s; i++) if(n % i == 0) return 0;<br /> return 1;<br />}<br /><br />int main() {<br /><br /> int pcount = 0;<br /> for(int i = 2; i <= 10000; i++) {<br /> isprime[i] = 0;<br /> if(isPrime(i)) {<br /> isprime[i] = 1;<br /> primes[pcount] = i;<br /> ind[i] = pcount;<br /> pcount++;<br /> }<br /> }<br /><br /> while(1) {<br /><br /> int n;<br /> cin >> n;<br /> if(n == 0) break;<br /><br /> int p = n;<br /> while(!isprime[p]) p--;<br /><br /> int start = ind[p];<br /> int sum = 0, c = 0;<br /> int i = start;<br /><br /> while(i >= 0) {<br /> while(n > sum) {<br /> sum += primes[i];<br /> i--;<br /> }<br /> if(sum == n) c++;<br /> sum -= primes[start];<br /> start--;<br /> }<br /><br /> cout << c << endl;<br /> }<br /><br />}<br /></span>____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);"></span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-28530361171535731252007-12-16T02:08:00.000-08:002007-12-17T00:29:13.228-08:00Prime Ring problem<pre><span style="font-weight: bold;font-size:130%;" >ACCEPTED</span><span><span style="font-size:130%;"> !!! A copy of this one was the opener at Coimbatore regionals 2006/07.<br />Its infact a simple BACKTRACKING problem</span></span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=7&page=show_problem&problem=465"><span style="font-size:130%;">Prime Ring Problem</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h"</span><br /><span style="color: rgb(51, 51, 255);">#include "stdio.h"</span><br /><br /><span style="color: rgb(51, 51, 255);">int n, mat[17][16], isprime[32];</span><br /><span style="color: rgb(51, 51, 255);">char seq[16];</span><br /><span style="color: rgb(51, 51, 255);">bool used[17];</span><br /><br /><span style="color: rgb(51, 51, 255);">int isPrime(int n) {</span><br /><span style="color: rgb(51, 51, 255);"> for(int i = 2; i < i ="=""><br /><span style="color: rgb(51, 51, 255);"> return 1;</span><br /><span style="color: rgb(51, 51, 255);">}</span><br /><br /><span style="color: rgb(51, 51, 255);">void permute(int count) {</span><br /><span style="color: rgb(51, 51, 255);"> if(count == n && isprime[seq[0] + seq[n-1]]) {</span><br /><span style="color: rgb(51, 51, 255);"> for(int i = 0; i <><br /><span style="color: rgb(51, 51, 255);"> if(i > 0) printf(" ");</span><br /><span style="color: rgb(51, 51, 255);"> printf("%d", seq[i]);</span><br /><span style="color: rgb(51, 51, 255);"> }</span><br /><span style="color: rgb(51, 51, 255);"> printf("\n");</span><br /><span style="color: rgb(51, 51, 255);"> return;</span><br /><span style="color: rgb(51, 51, 255);"> }</span><br /><span style="color: rgb(51, 51, 255);"> int last = seq[count-1];</span><br /><span style="color: rgb(51, 51, 255);"> int non = mat[last][0];</span><br /><span style="color: rgb(51, 51, 255);"> for(int i = 1; i <= non; i++) {</span><br /><span style="color: rgb(51, 51, 255);"> int next = mat[last][i];</span><br /><span style="color: rgb(51, 51, 255);"> if((next - count) % 2 != 0 && used[next] != 1) {</span><br /><span style="color: rgb(51, 51, 255);"> used[next] = true;</span><br /><span style="color: rgb(51, 51, 255);"> seq[count] = next;</span><br /><span style="color: rgb(51, 51, 255);"> permute(count + 1);</span><br /><span style="color: rgb(51, 51, 255);"> used[next] = false;</span><br /><span style="color: rgb(51, 51, 255);"> }</span><br /><span style="color: rgb(51, 51, 255);"> }</span><br /><span style="color: rgb(51, 51, 255);">}</span><br /><br /><span style="color: rgb(51, 51, 255);">int main()</span><br /><span style="color: rgb(51, 51, 255);">{</span><br /><br /><span style="color: rgb(51, 51, 255);"> for(int i = 3; i <= 31; i++ ) isprime[i] = isPrime(i);</span><br /><br /><span style="color: rgb(51, 51, 255);"> seq[0] = 1;</span><br /><span style="color: rgb(51, 51, 255);"> used[1] = true;</span><br /><br /><span style="color: rgb(51, 51, 255);"> int t = 1;</span><br /><span style="color: rgb(51, 51, 255);"> while(cin >> n) {</span><br /><span style="color: rgb(51, 51, 255);"> if(t > 1) cout <<><br /><span style="color: rgb(51, 51, 255);"> cout << "Case " <<><br /><span style="color: rgb(51, 51, 255);"> t++;</span><br /><span style="color: rgb(51, 51, 255);"> if(n % 2 == 1) continue;</span><br /><br /><span style="color: rgb(51, 51, 255);"> for(int i = 1 ; i <= n; i++) {</span><br /><span style="color: rgb(51, 51, 255);"> int c = 0;</span><br /><span style="color: rgb(51, 51, 255);"> for(int j = 2; j <= n; j++) if(isprime[i+j]) mat[i][++c] = j;</span><br /><span style="color: rgb(51, 51, 255);"> mat[i][0] = c;</span><br /><span style="color: rgb(51, 51, 255);"> }</span><br /><br /><span style="color: rgb(51, 51, 255);"> permute(1);</span><br /><span style="color: rgb(51, 51, 255);"> }</span><br /><span style="color: rgb(51, 51, 255);"> return 0;</span><br /><span style="color: rgb(51, 51, 255);">}</span><class><int><br /></int></class><br /><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-82678509862076007712007-12-14T03:14:00.000-08:002007-12-14T03:19:34.177-08:00Expression<pre><span style="font-weight: bold; font-size: 130%;">ACCEPTED</span><span><span style="font-size: 130%;"> !! Another good one from Dhaka regionals 2006/07</span></span><span style="font-size: 130%;"></span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=2193"><span style="font-size: 130%;">Expression</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h><br />#include "stack"<br />using namespace std;<br /><br />template <class><br />void exchange(T *arr, int a, int b) {<br /> T temp = arr[a];<br /> arr[a] = arr[b];<br /> arr[b] = temp;<br />}<br /><br />int main()<br />{<br /> int n;<br /> cin >> n;<br /> for(int i = 1; i <= n; i++) {<br /> char expr[200], digits[200];<br /> cin >> expr >> digits;<br /> int explen = strlen(expr);<br /> int dlen = strlen(digits);<br /><br /> int signarr[dlen];<br /> int prod = 1, sign = 1;<br /> stack<int> s;<br /> int index = 0;<br /> for(int j = 0; j < explen; j++) {<br /> if(expr[j] == '+') sign = 1;<br /> else if(expr[j] == '-') sign = -1;<br /> else if(expr[j] == '(') {<br /> prod *= sign;<br /> s.push(sign);<br /> sign = 1;<br /> }<br /> else if(expr[j] == ')') {<br /> prod *= s.top();<br /> s.pop();<br /> }<br /> else if(expr[j] == '#') signarr[index++] = prod * sign;<br /> }<br /><br /> index--;<br /> int count = 0;<br /> int parr[dlen];<br /> for(int j = explen - 1; j >= 0; j--) {<br /> if(expr[j] == '#') {<br /> parr[index] = signarr[index] * ++count;<br /> index--;<br /> }<br /> else count = 0;<br /> }<br /><br /> int indexarr[dlen];<br /> for(int j = 0; j < dlen; j++) indexarr[j] = j;<br /><br /> int fordarr[dlen];<br /> for(int j = 0; j < dlen; j++) {<br /> int s1 = parr[j], x1 = j;<br /> int s2 = digits[j], x2 = j;<br /> for(int k = j+1 ; k < dlen; k++) {<br /> if(parr[k] < s1 || (parr[k] == s1 && indexarr[k] < indexarr[x1])) {<br /> s1 = parr[k];<br /> x1 = k;<br /> }<br /> if(digits[k] < s2) {<br /> s2 = digits[k];<br /> x2 = k;<br /> }<br /> }<br /> exchange(parr, j, x1);<br /> exchange(indexarr, j, x1);<br /> exchange(digits, j, x2);<br /> fordarr[indexarr[j]] = digits[j];<br /> }<br /><br /> cout << "Case " << i << ":\n";<br /><br /> index = 0;<br /> long long int sum = 0;<br /> for(int j = 0; j < explen; j++) {<br /> long long int val = 0;<br /> while(expr[j] == '#') {<br /> cout << char(fordarr[index]);<br /> int c = fordarr[index] - '0';<br /> val = val * 10 + signarr[index] * c;<br /> index++;<br /> j++;<br /> }<br /> if(j < explen) cout << expr[j];<br /> sum += val;<br /> }<br /> cout << endl;<br /> cout << sum << endl;<br /> }<br /> return 0;<br />}<br /><br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-44788047503685232512007-12-14T03:06:00.000-08:002007-12-14T03:23:55.892-08:00Super long sumsHere's the problem statement: <a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=954">Super long sums</a><br />Accepted in the 7th try, after getting 6 Time Limit Exceeded errors. Moral of the story: don't use cin or cout as far as possible. Stick to ANSI C standards and use good ol' scanf and printf, though cumbersome!<br /><pre><br /><span style="color: rgb(51, 102, 255);">#include "iostream"</span><br /><span style="color: rgb(51, 102, 255);">#include "cstdio"</span><br /><br /><span style="color: rgb(51, 102, 255);">using namespace std;</span><br /><br /><span style="color: rgb(51, 102, 255);">main()</span><br /><span style="color: rgb(51, 102, 255);">{</span><br /><span style="color: rgb(51, 102, 255);"> int a[1000000];</span><br /><span style="color: rgb(51, 102, 255);"> int n, i, j, x, y, m;</span><br /><br /><span style="color: rgb(51, 102, 255);"> cin>>n;</span><br /><br /><span style="color: rgb(51, 102, 255);"> for(i=0; i</span><n; i=""><span style="color: rgb(51, 102, 255);"> 0) printf("\n");</span><br /><span style="color: rgb(51, 102, 255);"> scanf("%d", &m);</span><br /><span style="color: rgb(51, 102, 255);"> for(j=0; j<m; j++) {</span><br /><span style="color: rgb(51, 102, 255);"> scanf("%d%d",&x,&y);</span><br /><span style="color: rgb(51, 102, 255);"> a[j] = x+y;</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);"> for(j--; j>=0; j--) {</span><br /><span style="color: rgb(51, 102, 255);"> if(a[j] > 9) {</span><br /><span style="color: rgb(51, 102, 255);"> a[j-1]++;</span><br /><span style="color: rgb(51, 102, 255);"> a[j] -= 10;</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);"> for(j=0; j<m; j++) printf("%d", a[j]);</span><br /><span style="color: rgb(51, 102, 255);"> printf("\n");</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><br /><span style="color: rgb(51, 102, 255);"> return 0;</span><br /><span style="color: rgb(51, 102, 255);">}</span><br /><iostream><cstdio><n; i=""><m; d="" j=""><m; d="" n="" return=""><n; i=""><m; d="" j=""><m; d="" n="" return=""><iostream><cstdio><n; i=""><m; d="" j=""><m; d="" n="" return=""></m;></m;></n;></cstdio></iostream></m;></m;></n;></m;></m;></n;></cstdio></iostream></n;></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-7523165846167814442007-12-14T03:05:00.000-08:002007-12-14T03:11:34.041-08:00Potentiometers<pre><span style="font-weight: bold; font-size: 130%;">ACCEPTED</span><span><span style="font-size: 130%;"> !! Another one from Dhaka regionals</span></span> <span style="font-size:130%;">2006/07</span><span style="font-size: 130%;"></span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=2191"><span style="font-size: 130%;">Potentiometers</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h"<br />#include "math.h" <br /><br />int main()<br />{<br /><br /> int t = 1;<br /> while(1) {<br /> int n;<br /> cin >> n;<br /> if(n == 0) break;<br /> if(t > 1) cout << endl;<br /> int parr[n];<br /> int r = ceil(sqrt(n));<br /> int c = sqrt(n);<br /> int sparr[r];<br /> for(int i = 0; i < r; i++) sparr[i] = 0;<br /> for(int i = 0; i < n; i++) {<br /> cin >> parr[i];<br /> sparr[i/c] += parr[i];<br /> }<br /> cout << "Case " << t << ":\n";<br /> while(1) {<br /> char command[4];<br /> cin >> command;<br /> if(strcmp(command, "END") == 0) break;<br /> if(strcmp(command, "S") == 0) {<br /> int x, r;<br /> cin >> x >> r;<br /> x--;<br /> sparr[x/c] += r - parr[x];<br /> parr[x] = r;<br /> }<br /> else if(strcmp(command, "M") == 0) {<br /> int x, y;<br /> cin >> x >> y;<br /> x--;<br /> y--;<br /> int sr = x/c;<br /> int er = y/c;<br /> int res = 0;<br /> for(int i = sr; i < er; i++) res += sparr[i];<br /> for(int i = sr*c; i < x; i++) res -= parr[i];<br /> for(int i = er*c; i <= y; i++) res += parr[i];<br /> cout << res << endl;<br /> }<br /> }<br /> t++;<br /> }<br /> return 0;<br />}<br /><br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-66675512070824305122007-12-14T02:59:00.000-08:002007-12-14T03:22:39.102-08:00Andy's ShoesHere's the problem statement: <a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=2305">Andy's Shoes</a><br />Accepted in the 3rd try. The last one was with Dileep's help.<br /><pre><br /><span style="color: rgb(51, 102, 255);">#include <iostream></span><br /><span style="color: rgb(51, 102, 255);">using namespace std;</span><br /><br /><span style="color: rgb(51, 102, 255);">void swap(int *arr, int i, int j) {</span><br /><span style="color: rgb(51, 102, 255);"> int temp = arr[i];</span><br /><span style="color: rgb(51, 102, 255);"> arr[i] = arr[j];</span><br /><span style="color: rgb(51, 102, 255);"> arr[j] = temp;</span><br /><span style="color: rgb(51, 102, 255);">}</span><br /><br /><span style="color: rgb(51, 102, 255);">int main() {</span><br /><span style="color: rgb(51, 102, 255);"> int n;</span><br /><span style="color: rgb(51, 102, 255);"> cin >> n;</span><br /><span style="color: rgb(51, 102, 255);"> for(int i = 0; i < n; i++) {</span><br /><span style="color: rgb(51, 102, 255);"> int m;</span><br /><span style="color: rgb(51, 102, 255);"> cin >> m;</span><br /><span style="color: rgb(51, 102, 255);"> int arr[2*m], pair[10001];</span><br /><span style="color: rgb(51, 102, 255);"> for(int j = 0; j < 2*m; j++) {</span><br /><span style="color: rgb(51, 102, 255);"> cin >> arr[j];</span><br /><span style="color: rgb(51, 102, 255);"> pair[arr[j]] = j;</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);"> </span><br /><span style="color: rgb(51, 102, 255);"> int s = 0;</span><br /><span style="color: rgb(51, 102, 255);"> for(int j = 0; j < 2*m; j+=2) {</span><br /><span style="color: rgb(51, 102, 255);"> if(arr[j] != arr[j+1]) {</span><br /><span style="color: rgb(51, 102, 255);"> if(pair[arr[j+1]] < pair[arr[j]])</span><br /><span style="color: rgb(51, 102, 255);"> pair[arr[j+1]] = pair[arr[j]];</span><br /><span style="color: rgb(51, 102, 255);"> swap(arr, pair[arr[j]], j+1);</span><br /><span style="color: rgb(51, 102, 255);"> s++;</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);"> cout << s << endl;</span><br /><span style="color: rgb(51, 102, 255);"> }</span><br /><span style="color: rgb(51, 102, 255);">}</span><br /></pre>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-77537671150427008282007-12-12T06:48:00.000-08:002007-12-12T06:55:56.029-08:00Mobile Casanova<pre><span style="font-weight: bold; font-size: 130%;">ACCEPTED</span><span><span style="font-size: 130%;"> !! Yet another opener...this one from last year's Dhaka regionals</span></span><span style="font-size: 130%;"></span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=2189"><span style="font-size: 130%;">Mobile Casanova</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h"<br />#include "math.h"<br /><br />int compareEnds(int start, int end) {<br /> int n = floor(log(start)) + 1;<br /> int p = 1;<br /> for(int i = 0; i <= n; i++) {<br /> if(start / p == end / p) return i;<br /> p *= 10;<br /> }<br />}<br /><br />void printRange(int start, int count) {<br /> cout << "0";<br /> if(count == 0) cout << start << endl;<br /> else {<br /> int end = start + count;<br /> int d = compareEnds(start, end);<br /> cout << start << "-" << end % (int)pow(10, d) << endl;;<br /> }<br />}<br /><br />int main()<br />{<br /><br /> int t = 1;<br /> while(1) {<br /> int n;<br /> cin >> n;<br /> if(n == 0) break;<br /> cout << "Case " << t << ":\n";<br /> int count = 0,start;<br /> cin >> start;<br /> for(int i = 1; i < n; i++) {<br /> int curr;<br /> cin >> curr;<br /> if(curr == start + count + 1) count++;<br /> else {<br /> printRange(start, count);<br /> count = 0;<br /> start = curr;<br /> }<br /> }<br /> printRange(start, count);<br /> cout << endl;<br /> t++;<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-90985688761426220042007-12-12T06:29:00.000-08:002007-12-12T06:48:28.158-08:00All Integer Average<pre><span style="font-weight: bold; font-size: 130%;">ACCEPTED</span><span><span style="font-size: 130%;"> !!! The opener in Dhaka regional 2004/05</span></span><span style="font-size: 130%;"></span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=3012"><span style="font-size: 130%;">All Integer Average</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h"<br />#include "math.h"<br />#include "iomanip.h"<br /><br />int HCF(int a, int b) {<br /> if(a % b == 0) return b;<br /> return HCF(b, a % b);<br />}<br /><br />void printFraction(int n, int d) {<br /> int neg = 0;<br /> if(n < 0) {<br /> neg = 1;<br /> n *= -1;<br /> }<br /> if(d == 1) {<br /> if(neg) cout << "- " << n << endl;<br /> else cout << n << endl;<br /> }<br /> else {<br /> int whole = n / d;<br /> int fnum = n % d;<br /> int fden = d;<br /> int flen = int(floor(log(fden) / log(10)) + 1);<br /> int wlen = 0;<br /> if(whole > 0) wlen = int(floor(log(whole) / log(10)) + 1);<br /> int offset = wlen + flen;<br /> if(neg) offset += 2;<br /> cout << setw(offset) << fnum << endl;<br /> if(neg) cout << "- ";<br /> if(whole > 0) cout << whole;<br /> for(int i = 0; i < flen; i++) cout << "-";<br /> cout << setw(offset) << fden << endl;<br /> }<br />}<br /><br />int main()<br />{<br /> int count = 1;<br /> while(1) {<br /> int n;<br /> cin >> n;<br /> if(n == 0) break;<br /> int sum, den = n;<br /> cin >> sum;<br /> for(int i = 2; i <= n; i++) {<br /> int num;<br /> cin >> num;<br /> sum += num;<br /> }<br /> int c = HCF(abs(sum), den);<br /> sum /= c;<br /> den /= c;<br /> cout << "Case " << count << ":\n";<br /> printFraction(sum, den);<br /> count++;<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-31071278923821093102007-12-11T05:36:00.000-08:002007-12-11T05:40:29.969-08:00Bachelor Arithmetic<pre><span style="font-weight: bold;font-size:130%;" >ACCEPTED</span><span><span style="font-size:130%;"> !!! </span></span><span style="font-size:130%;">I missed this one during the Dhaka regionals due to a silly error...</span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=4055"><span style="font-size:130%;">Bachelor Arithmetic</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h"<br /><br />int main()<br />{<br /> int count = 1;<br /> while(1) {<br /> long long int b, s;<br /> cin >> b >> s;<br /> if(b == 0 && s == 0) break;<br /> cout << "Case " << count << ": :-";<br /> if(b <= s) {<br /> if(b == 1) cout << "\\";<br /> else cout << "|";<br /> }<br /> if(b > s) cout << "(";<br /> cout << endl;<br /> count++;<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-36276154067171990362007-12-11T05:30:00.000-08:002007-12-11T05:35:26.486-08:00Nested Squares<pre><span style="font-size: 130%;">This is my only <span style="font-weight: bold;">ACCEPTED</span> submission during the Dhaka regionals !!! </span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acmicpc-live-archive.uva.es/nuevoportal/data/problem.php?p=4056"><span style="font-size: 130%;">Nested Squares</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br /><br />int main()<br />{<br /> int ns;<br /> cin >> ns;<br /> for(int i = 1; i <= ns; i++) {<br /> cout << "Square " << i << ":" << endl;<br /> char strin[50002];<br /> int nq;<br /> cin >> strin >> nq;<br /> int len = strlen(strin);<br /> int doublen = 2 * len;<br /><br /> for(int j = 1; j <= nq; j++) {<br /> cout << "Query " << j << ":" << endl;<br /> int sx, sy, bx, by;<br /> cin >> sx >> sy >> bx >> by;<br /><br /> for(int k = sx; k <= bx; k++) {<br /> for(int l = sy; l <= by; l++) {<br /> int x = k, y = l;<br /> if(k > len) x = doublen - k;<br /> if(l > len) y = doublen - l;<br /> int min = (x < y)?x:y;<br /> cout << strin[min-1];<br /> }<br /> cout << endl;<br /> }<br /> }<br /> cout << endl;<br /> }<br /> return 0;<br />}<br /><iostream.h><iomanip.h></iomanip.h></iostream.h></span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-5715021845449531922007-12-10T06:01:00.000-08:002007-12-10T06:05:17.493-08:00Multifactorials<pre><span style="font-size:100%;"><span style="font-size: 130%;"><span style="font-weight: bold;">ACCEPTED</span> !!! </span><span style="font-size: 130%;">The <a href="http://online-judge.uva.es/board/">UVa forum</a> posts contain very handy test cases.. </span></span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2322"><span style="font-size: 130%;">Multifactorials</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br />#include "math.h"<br /><br />long long int max = pow(10, 18);<br />int primes[1000], pcount;<br /><br />int isPrime(int n) {<br /> double sq = sqrt(n);<br /> for(int i = 2; i <= sq; i++) if(n % i == 0) return 0;<br /> return 1;<br />}<br /><br />void updateFactors(int t, int *pfactorcount) {<br /> for(int i = 0; i < pcount; i++) {<br /> int p = primes[i];<br /> while(t % p == 0) {<br /> t /= p;<br /> pfactorcount[p]++;<br /> }<br /> if(t == 1) break;<br /> }<br />}<br /><br />long long int multiFactovisors(int n, int k) {<br /> int stop;<br /> if(k == 0) stop = n;<br /> else {<br /> if(n % k == 0) stop = k;<br /> else stop = n % k;<br /> }<br /> int pfactorcount[1000];<br /> for(int i = 0; i < 1000; i++) pfactorcount[i] = 0;<br /> int i = 0;<br /> while(1) {<br /> int t = n - k * i;<br /> updateFactors(t, pfactorcount);<br /> i++;<br /> if(t == stop) break;<br /> }<br /> long long int prod = 1;<br /> for(int i = 0; i < pcount; i++) {<br /> prod *= (pfactorcount[primes[i]] + 1);<br /> if(prod > max || prod < 1) return 0;<br /> }<br /> return prod;<br />}<br /><br />int main()<br />{<br /> int pindex = 0;<br /> for(int i = 2; i < 1000; i++) if(isPrime(i)) primes[pindex++] = i;<br /> pcount = pindex;<br /><br /> int t;<br /> cin >> t;<br /> for(int i = 1; i <= t; i++) {<br /> char inp[25];<br /> cin >> inp;<br /> int n = atoi(inp);<br /> long long int r;<br /> if(n <= 0) r = 1;<br /> else {<br /> int j;<br /> for(j = 0; inp[j] != '!'; j++);<br /> int k = strlen(inp) - j;<br /> r = multiFactovisors(n, k);<br /> }<br /> cout << "Case " << i << ": ";<br /> if(r > 0) cout << r << endl;<br /> else cout << "Infinity\n";<br /> }<br /> return 0;<br />}<iostream.h><iomanip.h><br /></iomanip.h></iostream.h></span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-6860164346121399432007-12-09T22:14:00.000-08:002007-12-09T22:19:03.257-08:00Newspaper<pre><span style="font-size: 130%;"><span style="font-weight: bold;"></span>The <a href="http://online-judge.uva.es/board/">UVa forum</a> to the rescue again... <span style="font-weight: bold;">ACCEPTED</span> !!! </span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=2315"><span style="font-size: 130%;">Newspaper</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br />#include "iomanip.h"<br /><br />int main()<br />{<br /> int n;<br /> cin >> n;<br /> for(int t = 0; t < n; t++) {<br /><br /> unsigned long long int arr[256];<br /> for(int i = 0; i < 256; i++) arr[i] = 0;<br /><br /> int k;<br /> cin >> k;<br /> for(int j = 0; j < k; j++) {<br /> cin.ignore();<br /> unsigned char key = cin.get();<br /> long long int value;<br /> cin >> value;<br /> arr[int(key)] = value;<br /> }<br /><br /> int m;<br /> unsigned long long int pay = 0;<br /> cin >> m;<br /> cin.ignore();<br /> for(int i = 0; i < m; i++) {<br /> unsigned char c = cin.get();<br /> while(c != '\n') {<br /> pay += arr[int(c)];<br /> c = cin.get();<br /> }<br /> }<br /> cout.setf(ios::fixed);<br /> cout << setprecision(2) << pay / 100 << "." << setw(2) << setfill('0') << pay % 100 <<"$" << endl;<br /> }<br /> return 0;<br />}<iostream.h><iomanip.h><br /></iomanip.h></iostream.h></span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-90574196391195454492007-12-09T22:09:00.000-08:002007-12-10T06:12:15.581-08:00Exhibition<pre><span style="font-size:130%;"><span style="font-weight: bold;">ACCEPTED </span>!! Though late, i realize how useful the <a href="http://online-judge.uva.es/board/">UVa forum</a> is.... </span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2323"><span style="font-size:130%;">Exhibition</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">#include "iostream.h"<br />#include "iomanip.h"<br /><br />int main()<br />{<br /> int t;<br /> cin >> t;<br /> for(int i = 1; i <= t; i++) {<br /> int type[10001];<br /> for(int j = 0; j < 10001; j++) type[j] = 0;<br /> int mat[50][52];<br /> int n;<br /> cin >> n;<br /> for(int j = 0; j < n; j++) {<br /> int m;<br /> cin >> m;<br /> mat[j][0] = m;<br /> mat[j][1] = 0;<br /> for(int k = 0; k < m; k++) {<br /> cin >> mat[j][k+2];<br /> type[mat[j][k+2]]++;<br /> }<br /> }<br /><br /> int ucount = 0;<br /> for(int j = 0; j < n; j++) {<br /> for(int k = 0; k < mat[j][0]; k++) {<br /> type[mat[j][k+2]]--;<br /> }<br /><br /> for(int k = 0; k < mat[j][0]; k++) {<br /> if(type[mat[j][k+2]] == 0) {<br /> mat[j][1]++;<br /> ucount++;<br /> }<br /> type[mat[j][k+2]]++;<br /> }<br /> }<br /><br /> cout << "Case " << i << ":";<br /><br /> cout.setf(ios::fixed);<br /> for(int j = 0; j < n; j++) {<br /> double perc = 33.333333;<br /> if(ucount != 0) perc = mat[j][1] * 100.00 / ucount;<br /> cout << setprecision(6) << " " << perc << "%";<br /> }<br /> cout << endl;<br /> }<br /> return 0;<br />}</span><iostream.h><iomanip.h><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><br /></span></span></span></span></span></span></span></span></span></span></iomanip.h></iostream.h><span style="color: rgb(51, 51, 255);"><iostream.h><iomanip.h></iomanip.h></iostream.h></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-87747168809997938472007-12-09T00:10:00.000-08:002007-12-10T06:15:21.561-08:00The Huge One<pre><span style="font-size:130%;"><span style="font-weight: bold;">ACCEPTED </span>!!! really HUGE but straightforward ...</span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=2319"><span style="font-size:130%;">The Huge One</span></a></pre><pre>____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br />#include "string.h"<br /><br />int divisible(char *num, int k) {<br /> int len = strlen(num), v, v0, v1, v2, last2, last3, sum, sum1, sum2, i;<br /> char bkp[1002];<br /> switch(k) {<br /> case 1:<br /> return 1;<br /> case 2:<br /> v0 = num[len - 1] - '0';<br /> if(v0 % 2 == 0) return 1;<br /> return 0;<br /> case 3:<br /> sum = 0;<br /> for(int i = 0; i < len; i++) sum += num[i] - '0';<br /> if(sum % 3 == 0) return 1;<br /> return 0;<br /> case 4:<br /> v0 = num[len - 1] - '0';<br /> v1 = num[len - 2] - '0';<br /> last2 = v1 * 10 + v0;<br /> if(last2 % 4 == 0) return 1;<br /> return 0;<br /> case 5:<br /> if((num[len - 1] - '0') % 5 == 0) return 1;<br /> return 0;<br /> case 6:<br /> v0 = num[len - 1] - '0';<br /> sum = 0;<br /> for(int i = 0; i < len; i++) sum += num[i] - '0';<br /> if(v0 % 2 == 0 && sum % 3 == 0) return 1;<br /> return 0;<br /> case 7:<br /> strcpy(bkp, num);<br /> i = 0;<br /> while(i < len - 1) {<br /> v1 = bkp[i] - '0';<br /> v0 = bkp[i + 1] - '0';<br /> v = v1 * 3 + v0;<br /> bkp[i] = v / 10 + '0';<br /> bkp[i + 1] = v % 10 + '0';<br /> if(bkp[i] == '0') i++;<br /> }<br /> if((bkp[i] - '0') % 7 == 0) return 1;<br /> return 0;<br /> case 8:<br /> v0 = num[len - 1] - '0';<br /> v1 = num[len - 2] - '0';<br /> v2 = num[len - 3] - '0';<br /> last3 = v2 * 100 + v1 * 10 + v0;<br /> if(last3 % 8 == 0) return 1;<br /> return 0;<br /> case 9:<br /> sum = 0;<br /> for(int i = 0; i < len; i++) sum += num[i] - '0';<br /> if(sum % 9 == 0) return 1;<br /> return 0;<br /> case 10:<br /> if((num[len - 1] - '0') == 0) return 1;<br /> return 0;<br /> case 11:<br /> sum1 = 0;<br /> sum2 = 0;<br /> for(int i = 0, j = 1; i < len || j < len; i += 2, j += 2) {<br /> if(i < len) sum1 += num[i] - '0';<br /> if(j < len) sum2 += num[j] - '0';<br /> }<br /> if((sum1 - sum2) % 11 == 0) return 1;<br /> return 0;<br /> case 12:<br /> sum = 0;<br /> for(int i = 0; i < len; i++) sum += num[i] - '0';<br /> v0 = num[len - 1] - '0';<br /> v1 = num[len - 2] - '0';<br /> last2 = v1 * 10 + v0;<br /> if(sum % 3 == 0 && last2 % 4 == 0) return 1;<br /> return 0;<br /> default:<br /> return 1;<br /> }<br />}<br /><br />int main()<br />{<br /> int n;<br /> cin >> n;<br /> for(int t = 1; t <= n; t++) {<br /> char hugenum[1002];<br /> cin >> hugenum;<br /> int m;<br /> cin >> m;<br /> int j, k;<br /> for(j = 0; j < m; j++) {<br /> cin >> k;<br /> int r = divisible(hugenum, k);<br /> if(r == 0) break;<br /> }<br /> cout << hugenum;<br /> if(j == m) cout << " - Wonderful." << endl;<br /> else cout << " - Simple." << endl;<br /> while(m > </span><span><span style="color: rgb(51, 51, 255);">++j</span></span><span style="color: rgb(51, 51, 255);">) cin >> k;<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);"></span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-67931795717900309742007-12-07T08:25:00.000-08:002007-12-10T10:26:55.114-08:00Symmetric Matrix<pre><pre><pre><span style="font-size:130%;"><span><strong>ACCEPTED...Among the simplest i have seen.</strong></span></span><span style="font-size:130%;"><span><strong><br /></strong></span></span>____________________________________________________________________<br /></pre></pre>Question: <a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=2324">Symmetric Matrix<br /></a>____________________________________________________________________<br /><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre>#include "iostream.h"<br />#include "math.h"<br /><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre>int main()<br />{<br />int t;<br />cin >>t;<br />for(int i = 1; i <= t; i++) {<br /> cin.ignore(4);<br /> int n, sym = 1;<br /> cin >> n;<br /> long long int mat[n][n];<br /> for(int j = 0; j < k =" 0;">> mat[j][k];<br /> for(int j = 0; j <= ceil(n/2); j++) for(int k = 0; k < n; k++) if(mat[j][k] < 0 || mat[j][k] != mat[n - j - 1][n - k - 1]) sym = 0;<br /> cout << "Test #" << i << ": ";<br /> if(sym) cout << "Symmetric.\n";<br /> else cout << "Non-symmetric.\n";<br />}<br />return 0;<br />}<br /><span style="color: rgb(0, 0, 0);">____________________________________________________________________ </span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-83383918189841917272007-12-07T04:20:00.000-08:002007-12-10T10:25:34.694-08:00RectanglesBack in preparation after a while ... <strong>ACCEPTED !</strong><br />____________________________________________________________________<br />Question: <a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&page=show_problem&problem=2320">Rectangles</a><br />____________________________________________________________________<br /><br /><pre><span><pre><span style="color: rgb(51, 51, 255);"><pre><span><pre>#include "iostream.h"<br /><br />int max(int a, int b) {<br /> return (a > b)? a : b;<br />}<br /><br />int min(int a, int b) {<br /> return (a < b)? a : b;<br />}<br /><br />int main()<br />{<br /> int n;<br /> cin >> n;<br /> for(int i = 1; i <= n; i++) {<br /> int m;<br /> cin >> m;<br /> int smallx, smally, bigx, bigy;<br /> cin >> smallx >> smally >> bigx >> bigy;<br /> int j;<br /> for(j = 1; j < m; j++) {<br /> int sx, sy, bx, by;<br /> cin >> sx >> sy >> bx >> by;<br /> smallx = max(smallx, sx);<br /> smally = max(smally, sy);<br /> bigx = min(bigx, bx);<br /> bigy = min(bigy, by);<br /> if(smallx > bigx || smally > bigy) break;<br /> }<br /> int dummy;<br /> while(j++ < (m - 1)) cin >> dummy >> dummy >> dummy >> dummy;<br /> long long int area = (bigx - smallx) * (bigy - smally);<br /> if(area <= 0) area = 0;<br /> cout << "Case " << i << ": " << area << endl;<br /> }<br /> return 0;<br />}</pre></span></pre></span></pre></span></pre>____________________________________________________________________Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-20549987361249854182007-11-09T21:39:00.000-08:002007-11-09T21:54:47.957-08:00StringsProblem Statement: <a href="http://www.cse.iitb.ac.in/acm/problems/problem1.html">Strings</a><br />I couldn't verify my answer coz it's from an IIT site - no solution verifier. So I'm just posting my algo, not the code...<br /><br />Key:<br /> n : number of chars per string<br /> k : number of strings<br /> alpha[] : a 26 element int array which stores the number of occurrences of each alphabet in a column<br /><br />input n,k;<br />input the strings;<br />for i = 1 to n { //for each character<br /> for j = 1 to k { //for each string<br /> InitAlpha();<br /> alpha[strs[j][i]-'a']++;<br /> }<br /> noOfM += FindNoOfMaxAlpha();<br /> dist += k - alpha[FindMaxAlpha()];<br />}<br /><br />InitAlpha()<br />{<br /> for i=1 to 26<br /> alpha[i] = 0;<br />}<br /><br />FindMaxAlpha() //returns index (a=1,b=2,...) of the alphabet that has occurred max times in arr alpha[]<br />{<br /> max = 0;<br /> maxAlpha = 0; //index of alphabet that occurs max no of times<br /> for i = 1 to 26 {<br /> if alpha[i] > max {<br /> max = alpha[i]<br /> maxAlpha = i;<br /> }<br /> }<br /> return i;<br />}<br /><br />/* FindNoOfMaxAlpha()<br /> * if only one char occurs max times in alpha[] returns 1<br /> * otherwise, if there are >1 chars which occur max times, returns the no of such chars<br /> */<br />FindNoOfMaxAlpha() <br />{<br /> noOfMax = 0;<br /> max = 0;<br /> for i = 1 to k {<br /> if (alpha[i] > max) {<br /> max = alpha[i];<br /> noOfMax = 1;<br /> }<br /> else if (alpha[i] == max) noOfMax++;<br /> }<br /> return noOfMax;<br />}Unknownnoreply@blogger.com2tag:blogger.com,1999:blog-3177942999838728473.post-92224963560586703372007-10-10T09:09:00.000-07:002007-12-10T06:25:11.145-08:00Coupons<pre><span style="font-size:130%;"><span style="font-weight: bold;">ACCEPTED </span>in the 5th attempt !! Too many careless errors....</span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acm.uva.es/p/v102/10288.html"><span style="font-size:130%;">Coupons</span></a><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br />#include "math.h"<br />#include "iomanip.h"<br /><br /></span><span style="color: rgb(51, 51, 255);">long long int HCF(long long int big, long long int small) {<br /> if(big % small == 0) return small;<br /> return HCF(small, big % small);<br />}<br /><br />long long int LCM(long long int a, long long int b) {<br /> return a * b / HCF(a, b);<br />}<br /><br />long long int nLCM(int n) {<br /> if(n == 1) return 1;<br /> return LCM(n, nLCM(n - 1));<br />}<br /><br />int countDigits(long long int n) {<br /> int i;<br /> if(!n) return 1;<br /> for(i = 0; n; i++) n/=10;<br /> return i;<br />}<br /><br />int max(int a, int b) {<br /> return (a > b)? a : b;<br />}<br /><br />int main() {<br /> int n;<br /> while(cin >> n) {<br /> long long int numer = 0;<br /> long long int denom = nLCM(n);<br /> for(int k = 1; k <= n; k++) numer += denom / k;<br /> denom /= n;<br /> long long int hcf = HCF(numer, denom);<br /> numer /= hcf;<br /> denom /= hcf;<br /> long long int whole = numer / denom;<br /> numer = numer % denom;<br /> int wn = countDigits(whole);<br /> int fn = max(countDigits(numer), countDigits(denom));<br /> if(numer == 0) cout << whole << endl;<br /> else {<br /> cout << setw(wn + 1) << " " << numer << endl;<br /> cout << whole << " " << setw(fn) << setfill('-') << "" << endl;<br /> cout << setw(wn + 1) << setfill(' ') << " " << denom << endl;<br /> }<br /> }<br /> return 0;<br />}</span><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-26815325951788284022007-10-09T04:17:00.000-07:002007-10-09T04:19:14.349-07:00Light, More Light<pre><span style="font-size: 130%;"><span style="font-weight: bold;">ACCEPTED </span>!! Simpler than i thought....</span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acm.uva.es/p/v101/10110.html"><span style="font-size:130%;">Light, More Light</span></a></pre><pre>____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br />#include "math.h"<br /><br />int main() {<br /> while(true) {<br /> unsigned int n;<br /> cin >> n;<br /> if(n == 0) break;<br /> int root = sqrt(n);<br /> if((root * root) == n) cout << "yes\n";<br /> else cout << "no\n";<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-16725083265992834532007-10-08T10:56:00.000-07:002007-10-08T11:05:23.999-07:00Dropping Water Balloons<pre><span style="font-size: 130%;"><span style="font-weight: bold;">ACCEPTED </span>again !!! This one was good....</span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size: 130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><a href="http://acm.uva.es/p/v109/10934.html"><span style="font-size:130%;"><span class="mw-headline">Dropping Water Balloons</span></span></a></pre><pre>____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br /><br /></span><span style="color: rgb(51, 51, 255);">long long int floor[64][101];<br /><br />long long int maxFloors(int t, int k) {<br /> if(floor[t][k] != 0) return floor[t][k];<br /> if(t == 1) floor[t][k] = 1;<br /> else if(k == 1) floor[t][k] = t;<br /> else floor[t][k] = 1 + maxFloors(t - 1, k - 1) + maxFloors(t - 1, k);<br /> return floor[t][k];<br />}<br /><br />int main() {<br /> long long int n;<br /> int k, t;<br /> while(true) {<br /> cin >> k;<br /> cin >> n;<br /> if(k == 0) break;<br /> for(t = 1; t <= 63; t++) if(maxFloors(t, k) >= n) break;<br /> if(t > 63) cout << "More than 63 trials needed.\n";<br /> else cout << t << endl;<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-62644783383690516872007-10-08T03:30:00.000-07:002007-10-08T03:35:41.974-07:00Funny Encryption<pre><span style="font-size:130%;">I am seeing myself <span style="font-weight: bold;">ACCEPTED </span>more often nowadays<span style="font-weight: bold;">...</span></span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: </span></span></span><span style=";font-family:arial;font-size:130%;" ><a style="color: rgb(0, 0, 0);" href="http://acm.uva.es/p/v100/10019.html"><b>Funny Encryption Method</b></a></span><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"<br /><br /></span><span style="color: rgb(51, 51, 255);">int countSetBits(int n) {<br /> int count = 0;<br /> while(n) {<br /> n = n & (n - 1);<br /> count++;<br /> }<br /> return count;<br />}<br /><br />int main() {<br /> int n, m, b1, b2;<br /> cin >> n;<br /> for(int i = 1; i <= n; i++) {<br /> cin >> m;<br /> b1 = countSetBits(m);<br /> b2 = 0;<br /> while(m) {<br /> b2 += countSetBits(m % 10);<br /> m = m / 10;<br /> }<br /> cout << b1 << " " << b2 << endl;<br /> }<br /> return 0;<br />}<br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-2396113646991993362007-10-08T02:59:00.000-07:002007-12-10T06:28:26.524-08:00Euclidian Clock<pre><span style="font-size:130%;"><span>I chose this one <span style="font-weight: bold;">randomly </span>from</span><span style="font-weight: bold;"> <a href="http://www.algorithmist.com/">Algorithmist</a></span></span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: <a href="http://www.algorithmist.com/index.php/LA_-_The_Euclidian_Clock"><span style="text-decoration: underline;">Euclidian Clock</span></a><a href="http://www.algorithmist.com/index.php/LA_-_The_Euclidian_Clock"><span style="text-decoration: underline;"></span></a></span></span><a style="color: rgb(0, 0, 153);" href="http://acm.uva.es/p/v100/10038.html"><span style="color: rgb(0, 0, 102);"></span></a></span><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(255, 153, 0);">#include "iostream.h"<br />#include "math.h"<br />#include "iomanip.h"<br /><br />int main() {<br /> double d, h, m, s, u;<br /> double hrs1, hrs2, pi = 2*acos(0), ans, area, r;<br /> cin >> d;<br /> for(int i = 1; i <= d; i++) {<br /> cin >> h>> m>> s >> u;<br /> hrs1 = h + m/60 + s/3600 + u/360000;<br /> cin >> h>> m>> s >> u;<br /> hrs2 = h + m/60 + s/3600 + u/360000;<br /> cin >> r;<br /> area = pi * r * r;<br /> ans = (hrs2 - hrs1)/12 * area;<br /> cout << i << ". " << fixed << setprecision(3) << ans << endl;<br /> }<br /> return 0;<br />}</span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><br /></span></span></span></span></span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-30505577694746866352007-10-06T21:55:00.000-07:002007-10-06T21:58:07.159-07:00Cutting Sticks<pre><span style="font-size: 130%;">Yeah!!! Another one <span style="font-weight: bold;">ACCEPTED...</span></span><br />____________________________________________________________________<br /><span style="font-weight: bold; font-size: 100%;"><span style="font-size:130%;"><span style="color: rgb(0, 0, 102);">Question: <a href="http://acm.uva.es/p/v100/10003.html"><span style="text-decoration: underline;">Cutting Sticks</span></a></span></span><a style="color: rgb(0, 0, 153);" href="http://acm.uva.es/p/v100/10038.html"><span style="color: rgb(0, 0, 102);"></span></a></span><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"</span><br /><span style="color: rgb(51, 51, 255);"><br />int cut[52], cost[52][52];<br /><br />int minCost(int start, int end) {<br /> if(cost[start][end] != -1) return cost[start][end];<br /> if(start + 1 == end) return cost[start][end] = 0;<br /> int min = 65536;<br /> for(int i = start + 1; i < end; i++) {<br /> int c = minCost(start, i) + minCost(i, end) + (cut[end] - cut[start]);<br /> if(c < min) min = c;<br /> }<br /> return cost[start][end] = min;<br />}<br /><br />int main()<br />{<br /> int l, n;<br /> while(true) {<br /> cin >> l;<br /> if(l == 0) break;<br /> cin >> n;<br /> cut[0] = 0;<br /> for(int i = 1; i <= n; i++) cin >> cut[i];<br /> cut[n + 1] = l;<br /> for(int i = 0; i <= n + 1; i++) for(int j = 0; j <= n + 1; j++) cost[i][j] = -1;<br /> cout << "The minimum cutting is " << minCost(0, n + 1) << ".\n";<br /> }<br /> return 0;<br />}</span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><br /></span></span></span></span></span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-60302428308059724272007-10-05T03:05:00.000-07:002007-12-10T06:30:21.390-08:00Wythoff's Game<span style="font-size:100%;">This one is not there in <a href="http://icpcres.ecs.baylor.edu/onlinejudge/index.php">UVa online judge</a> . Hope it works !<br /></span>____________________________________________________________________<br /><span style="color: rgb(0, 0, 153);">Question: <a href="http://www.iarcs.org.in/inoi/contests/nov2005/Advanced-2.php"><span style="text-decoration: underline;">Wythoff's Queen Game</span></a></span><br />____________________________________________________________________<br /><pre><span style="color: rgb(255, 153, 0);">#include "iostream.h"<br />#include "math.h"<br /></span><span style="color: rgb(255, 153, 0);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(255, 153, 0);"></span></span></span><span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(255, 153, 0);"></span><br /><span style="color: rgb(255, 153, 0);">int main() {<br /><span><span> </span></span>int n, x, y, small, big, diff;<br /><span><span> </span></span>float phi = (sqrt(5) + 1)/2;<br /><span><span> </span></span>cin >> n >> x >> y;<br /><span><span> </span></span>x--;<br /><span><span> </span></span>y = n - y;<br /><span><span> </span></span>small = (x < y)?x:y;<br /><span><span> </span></span>big = x + y - small;<br /><span><span> </span></span>diff = floor(small / phi);<br /><span><span> </span></span>if(small + diff + 1 == big) cout << "2\n";<br /><span><span> </span></span>else cout << "1\n";<br /><span><span> </span></span>return 0;<br />}</span></span></span><span style="color: rgb(51, 51, 255);"><br /></span><span><span style="color: rgb(51, 51, 255);"></span></span>____________________________________________________________________<br /><br /></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com0tag:blogger.com,1999:blog-3177942999838728473.post-28837849025766132082007-09-28T06:53:00.000-07:002007-12-10T10:30:41.305-08:00Jolly Jumpers<pre><span style="font-size:130%;">Corrected & Accepted !!! (Thanks to xanden for his comments) </span><br />____________________________________________________________________<br /><span style="font-weight: bold;font-size:100%;" ><span style="color: rgb(0, 0, 102);">Question: </span><a style="color: rgb(0, 0, 153);" href="http://acm.uva.es/p/v100/10038.html"><span style="color: rgb(0, 0, 102);">Jolly Jumpers</span></a></span><br />____________________________________________________________________<br /><span style="color: rgb(51, 51, 255);"><br />#include "iostream.h"</span><br /><span style="color: rgb(51, 51, 255);"><br /></span><span style="color: rgb(51, 51, 255);">int main()<br />{<br /> int n, n1, n2, arr[3001], diff, flag;<br /> while(cin >> n) {<br /> for(int i = 1; i < n; i++) arr[i] = 0;<br /> cin >> n1;<br /> flag = 0;<br /> for(int i = 1; i < n; i++) {<br /> cin >> n2;<br /> diff = (n1 > n2)?(n1 - n2):(n2 - n1);<br /> if(diff > 0 </span><span style="color: rgb(51, 51, 255);">&& n > diff<span style="color: rgb(51, 51, 255);">) {<br /> if(arr[diff] != 1) arr[diff] = 1;<br /> else flag = 1;<br /> }<br /> else flag = 1;<br /> n1 = n2;<br /> }<br /> if(flag == 0) cout << "Jolly" << endl;<br /> else cout << "Not jolly" << endl;<br /> }<br /> return 0;<br />}<br /></span></span><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(51, 51, 255);"><span style="color: rgb(0, 0, 0);">____________________________________________________________________</span><br /></span></span></span></span></span></span></span></span></span></span></span></span></span></span></pre>Dileep P Ghttp://www.blogger.com/profile/07803904268172535657noreply@blogger.com2