|  | 
|  | 
| back to board | Just don't get it! My prog got AC with "unsigned int n,m" and with "long" it failed!!! Posted by ValBG  11 Feb 2003 03:58#include <iostream.h>
 int main()
 {
 unsigned int n,m;      //when this is long i get WA
 cin>>n>>m;
 if (n<=m) cout<<2*(n-1); else cout<<2*m-1;
 return 0;
 }
Re: Just don't get it! My prog got AC with "unsigned int n,m" and with "long" it failed!!! But why do you think tha's strange? You write 2*(n-1) in your code,thus, since n<2^31, 2*(n-1) could be close to 2^32, and you are to
 use unsigned.
 | 
 | 
|