## Search found 16 matches

Sat Feb 28, 2015 5:20 am
Forum: Volume 120 (12000-12099)
Topic: 12043 - Divisors
Replies: 6
Views: 3359

### 12043 - Divisors

I don't understand why am I getting WA in this problem #include <stdio.h> long long num, sum; int d(int n) { int i; sum = 0; num = 0; for(i=1; i*i<n; i++) { if(n % i == 0) { num += 2; sum += i + n/i; } } if(i*i == n) { num += 1; sum += i; } } int main() { int a, b, k; long long g, h; int i, t, n; sc...
Fri Aug 29, 2014 3:59 pm
Forum: Volume 5 (500-599)
Topic: 594 - One Little, Two Little, Three Little Endians
Replies: 46
Views: 14113

### Re: 594 - One Little, Two Little, Three Little Endians

I get correct answer for all the test cases I found so far, but yet I get WA :( Please tell me what am I doing wrong here #include <stdio.h> #include <string.h> #include <math.h> unsigned Pow(int a, int p) { if (p == 0) return 1; unsigned ret = a, i; for (i = 1; i < p; i++) ret *= a; return ret; } v...
Tue Aug 26, 2014 6:55 pm
Forum: Volume 118 (11800-11899)
Topic: 11821 - High-Precision Number
Replies: 8
Views: 5386

### Re: 11821 - High-Precision Number

I have changed the code as you said, but still WA

Please tell me if logic is OK or not.
Thu Aug 21, 2014 7:26 pm
Forum: Volume 118 (11800-11899)
Topic: 11821 - High-Precision Number
Replies: 8
Views: 5386

### 11821 - High-Precision Number

Can anybody please tell me what am I doing wrong here: import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.math.BigDecimal; public class Main { static BigDecimal num, sum; static String line; public static void main(String[] args) throws IOExcepti...
Thu Aug 14, 2014 5:22 pm
Forum: Volume 7 (700-799)
Topic: 763 - Fibinary Numbers
Replies: 40
Views: 16448

### Re: 763 - Fibinary Numbers

Thanks brianfry713. It really was a silly mistake, forgetting re-initialization of sum...
Sat Aug 09, 2014 8:36 pm
Forum: Volume 7 (700-799)
Topic: 763 - Fibinary Numbers
Replies: 40
Views: 16448

### Re: 763 - Fibinary Numbers

Check your outputs for the inputs(1589 lines) given by brianfry713 in this thread. In fact I checked your program's output with that from UVa toolkit and they do not match. My program however gives correct output for all of them, yet I get WA, how come???????????????????????????????????????? This pr...
Sun Aug 03, 2014 2:43 pm
Forum: Volume 7 (700-799)
Topic: 763 - Fibinary Numbers
Replies: 40
Views: 16448

### Re: 763 - Fibinary Numbers

Hi brianfry713, I get correct answers for all of them, I checked up with UVa toolkit. STILL I am getting WA. This is really freaking me out
Fri Aug 01, 2014 12:06 pm
Forum: Volume 7 (700-799)
Topic: 763 - Fibinary Numbers
Replies: 40
Views: 16448

### Re: 763 - Fibinary Numbers

The code complies on my machine (both in VS13 and CodeBlocks13 with their respective default compilers) and gives correct output for all the inputs I found on this website. But the judge says Runtime error. Please help. I can't find the spot where it might go wrong and give runtime error N.B. i used...
Thu Jul 31, 2014 2:51 pm
Forum: Volume 7 (700-799)
Topic: 763 - Fibinary Numbers
Replies: 40
Views: 16448

### 763 - Fibinary Numbers

Why am I getting RE?? The code uses a BigInteger class made by myself #include <iostream> #include <string> #include <vector> #include <stdio.h> #include <string.h> using namespace std; #define MODDER 1000000000 #define DIGITSIZE 9 //#define MODDER 10000 //#define DIGITSIZE 4 #define INT32 int #defi...
Sat Jul 19, 2014 11:53 am
Forum: Volume 115 (11500-11599)
Topic: 11526 - H(n)
Replies: 49
Views: 17236

### Re: 11526 - H(n)

Why is this code getting WA? #include <stdio.h> #include <math.h> int main() { int n, T, sqrtn, i, l1, l2, k; unsigned long long sum, sum2; scanf("%d", &T); while(T--) { scanf("%d", &n); if(n < 0) n = -n; sum = n; sqrtn = sqrt(n); k = 1, l2 = n; for(i=2; i<=sqrtn; i++) { l1 = n/i; sum += l1; if(l2 !...
Tue Jul 15, 2014 12:43 pm
Forum: Volume 102 (10200-10299)
Topic: 10258 - Contest Scoreboard
Replies: 87
Views: 35423

### Re: 10258 - Contest Scoreboard

This (and many other problems in UVa) says the output cases are separated by new lines. This in no sense says that the last output case should have a new line at the end. But you will get WA if don't put new line at the end of last output case, ie. you get WA if pay the exact attention to the detail...
Tue Apr 01, 2014 8:20 pm
Forum: Volume 4 (400-499)
Topic: 459 - Graph Connectivity
Replies: 132
Views: 26179

### Re: uva 459

Please somebody help me. I am getting TLE in this problem... #include <bits/stdc++.h> using namespace std; int par[30]; int num; void makeset(int n) { par[n] = n; } int findpar(int n) { if(par[n] == n) return n; else return (par[n] = findpar(n)); } void Union(int a, int b) { int para = findpar(a); i...
Wed Mar 26, 2014 7:21 pm
Forum: Volume 4 (400-499)
Topic: 459 - Graph Connectivity
Replies: 132
Views: 26179

### Re: uva 459

Please somebody help me with this code. I am getting TLE... It gives correct answers I think #include <bits/stdc++.h> using namespace std; int par[30]; void makeset(int n) { par[n] = n; } int findpar(int n) { if(par[n] == n) return n; else return (par[n] = findpar(par[n])); } void Union(int a, int b...
Sat Mar 15, 2014 4:28 pm
Forum: Volume 119 (11900-11999)
Topic: 11965 - Extra Spaces
Replies: 31
Views: 8083

### Re: 11965 - Extra Spaces

Please somebody tell me what I am doing wrong here #include <bits/stdc++.h> using namespace std; int main() { int t; scanf("%d", &t); int counter = 1; int n; char line[501]; char newLine[501]; int in; while(t--) { scanf("%d", &n); getchar(); printf("Case %d:\n", counter++); while(n--) { gets(line); ...
Mon Mar 03, 2014 8:32 pm
Forum: Volume 115 (11500-11599)
Topic: 11526 - H(n)
Replies: 49
Views: 17236

### Re: 11526 - H(n)

How to avoid time-limit exceed in this problem. All I know is the most obvious procedure will give time-limit exceed error. So where can I learn the faster algorithm from, pleeeeze anyone...