Search found 19 matches

by sahand
Tue Jun 07, 2005 4:42 pm
Forum: Volume 4 (400-499)
Topic: 499 - What's The Frequency, Kenneth?
Replies: 93
Views: 10285

I replaced this part of your code for(i=0;i<26;i++){ if(my[i]>=my[i+26]){ my[i]+=my[i+26]; if(max<my[i]){ max=my[i]; } my[i+26]=0; } else{ my[i+26]+=my[i]; if(max<my[i+26]){ max=my[i+26]; } my[i]=0; } with: max=0; for(i=0;i<52;i++) if(my[i]>max) max=my[i]; And got AC. Upper case letters are supposed...
by sahand
Tue Jun 07, 2005 4:17 pm
Forum: C++
Topic: A very simple program about "cin", What's the matt
Replies: 3
Views: 1862

Use this:

Code: Select all

#include <iostream.h>
void main(){
  int a;
  while(true){
    cin>>a;
    if(cin.fail()){
      cout<<"error"<<endl;
      cin.clear();
      break;
    }
    else{
      break;
    }
  }
}
cin.clear() does not do what you think it does. read the documentations.
by sahand
Fri May 13, 2005 3:00 am
Forum: Volume 5 (500-599)
Topic: 516 - Prime Land
Replies: 23
Views: 6477

You're not initializing the 'count' variable in genFac() function. You should always initialize variables unless they are global, or static. And, the way you start your program: #include <algorithm> #include <cctype> #include <cmath> #include <cstdlib> #include <fstream> #include <functional> #inclu...
by sahand
Mon May 09, 2005 8:00 pm
Forum: Volume 3 (300-399)
Topic: 383 - Shipping Routes
Replies: 27
Views: 5695

Hey,
My AC program outputs

Code: Select all

SHIPPING ROUTES OUTPUT

DATA SET OUTPUT 1
<one only blank line>
END OF OUTPUT
But if you're getting WA instead of PE (Presentation Error) you should consider checking your algorithm instead.

Good luck,
Sahand.
by sahand
Mon May 02, 2005 4:02 am
Forum: Volume 3 (300-399)
Topic: 383 - Shipping Routes
Replies: 27
Views: 5695

There should be an 'Edit' button right next to your post.
Take care...
by sahand
Fri Apr 29, 2005 6:16 pm
Forum: Volume 3 (300-399)
Topic: 386 - Perfect Cubes
Replies: 53
Views: 6964

Hi, I think most of those 0:00 for this problem are done using pre calculation. Maybe even all of them! Anyway, I think you can optimize your code a good amount in the following way. I could get it accepted in 0:00.980 which is not really good, but is still better. #include <stdio.h> int main() { in...
by sahand
Fri Apr 29, 2005 5:58 pm
Forum: Volume 3 (300-399)
Topic: 383 - Shipping Routes
Replies: 27
Views: 5695

Try this input: 1 4 5 3 AA AD AC AB AC AB AB AD AC AD AA AC AA AB 10 AA AD 10 AA AC 10 AC AD Your output: SHIPPING ROUTES OUTPUT DATA SET 1 NO SHIPMENT POSSIBLE $1000 NO SHIPMENT POSSIBLE END OF OUTPUT Correct output: SHIPPING ROUTES OUTPUT DATA SET 1 $2000 $1000 $1000 END OF OUTPUT Good luck, :wink:
by sahand
Thu Apr 28, 2005 3:08 pm
Forum: Volume 3 (300-399)
Topic: 320 - Border
Replies: 24
Views: 2275

I checked your code and it seems it's more a problem with your algorithm than the way you treat input. Hint: Inside this loop: for (j=0;j<(signed)strlen(a)-1;j++) {....} You can accomplish what you want by using only a . There's no need to look ahead. And also, It's better if you include your files ...
by sahand
Thu Apr 28, 2005 2:57 pm
Forum: Volume 3 (300-399)
Topic: 325 - Identifying Legal Pascal Real Constants
Replies: 63
Views: 14643

Thanks a lot, I got AC :)
It was a very simple mistake!
by sahand
Wed Apr 27, 2005 3:42 pm
Forum: Volume 3 (300-399)
Topic: 325 - Identifying Legal Pascal Real Constants
Replies: 63
Views: 14643

Yes, I checked that. I was not correct but I corrected it and I still get WA.
Here's the new code:

Code: Select all

code removed
Thanks!
by sahand
Wed Apr 27, 2005 3:35 pm
Forum: Volume 3 (300-399)
Topic: 352 - The Seasonal War
Replies: 54
Views: 12799

I got AC. Thanks! :D
by sahand
Tue Apr 26, 2005 12:10 am
Forum: Volume 3 (300-399)
Topic: 352 - The Seasonal War
Replies: 54
Views: 12799

352 - The Seasonal War - WA - Please help!!

Another problem that I keep getting WAs on without any good reason.
I checked all the sample input on the board but no luck!
Please help me!!

Code: Select all

code removed!
by sahand
Mon Apr 25, 2005 11:52 pm
Forum: Volume 3 (300-399)
Topic: 320 - Border
Replies: 24
Views: 2275

OK, Here's how I do it: int main() { int cases; cin>>cases; for(int casei=1;casei<=cases;casei++) { bool bitmap[32][32]; for(int i=0;i<32;i++) for(int j=0;j<32;j++) bitmap[i][j]=false; int x,y; cin>>x>>y; string line; getline(cin,line); if(line=="") getline(cin,line); for(int i=0;i<(int)line.size()-...
by sahand
Sun Apr 24, 2005 10:38 pm
Forum: Volume 3 (300-399)
Topic: 325 - Identifying Legal Pascal Real Constants
Replies: 63
Views: 14643

325 - Pascal real numbers - WA - please help!

This is my code for 325, but I keep getting WAs! I checked all the sample inputs on this board, and it gives correct output. I would really appreciate if somebody could tell me what i'm doing is wrong. P.S. I know it's not an efficient way of doing it. I know about FSMs but just didn't feel like doi...
by sahand
Sun Apr 24, 2005 10:34 pm
Forum: Volume 3 (300-399)
Topic: 320 - Border
Replies: 24
Views: 2275

I didn't check your program but here's the output I get from my AC code: Input: 3 2 1 EEENNNWWWSSS. 2 1 ENWS. 2 1 EEEEEEEEEENWWWWWWWWWWS. Output: Bitmap #1 ................................ ................................ ................................ ................................ ...............

Go to advanced search