scanf("%I64d",&p);

Write here if you have problems with your C++ source code

Moderator: Board moderators

Post Reply
Sid337
New poster
Posts: 2
Joined: Wed Jun 29, 2005 9:01 am
Contact:

scanf("%I64d",&p);

Post by Sid337 »

I can't anderstand what's going on! My program is :
#include <stdio.h>
int main()
{
__int64 p,k,m=0;
scanf("%I64d",&p);
...........................
printf("%I64d",m);
return 0;
}

And I got Compile error! I think i've got problem with input/ output please help... what I am to change?
javascript:emoticon(':(')


:( :( :( :( :( :( :( :( :(
chunyi81
A great helper
Posts: 293
Joined: Sat Jun 21, 2003 4:19 am
Location: Singapore

Post by chunyi81 »

Hi, UVA OJ uses g++ in linux, which supports long long for 64bit integers but not __int64. I suppose you are using a C++ programming IDE in Windows?

Use long long instead of __int64 and scanf("%lld",&p), printf("%lld,m)
or scanf("%Ld",&p), printf("%Ld,m)

Do browse the forum for threads related to your problem before posting next time.
Sid337
New poster
Posts: 2
Joined: Wed Jun 29, 2005 9:01 am
Contact:

Post by Sid337 »

:D
Thank you, very much!!!!
kanhabhu
New poster
Posts: 1
Joined: Tue Jun 12, 2012 3:45 pm

Post by kanhabhu »

import java.util.Scanner;
public class java4
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);

int n=sc.nextInt();
int i,j,d=0,t=0;
float c;
long a[]=new long[n];
long b[]=new long[n];

for( i=0;i<n;i++)
a=sc.nextLong();
for(i=0;i<n;i++)
{
c=0f;
for(j=0;j<n;j++)
{
if(i!=j)
c+=a[j];
}
c=(float)c/(n-1);
if(a==c)
{
d++;
b[t++]=i+1;

}

}


System.out.println(d);
for(i=0;i<d;i++)
System.out.print(b+" ");


}


}
//whats wrong in it ??gives error on 10th test during runtime..plz help
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: scanf("%I64d",&p);

Post by brianfry713 »

What's the problem number? Why did you post this here?
Check input and AC output for thousands of problems on uDebug!
Post Reply

Return to “C++”