-
-
Save mukeshkdangi/6608909 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main(){ | |
long int a[100001],b[100001],c[100001],t=0,i,j,n; | |
while(1){ | |
scanf("%ld",&n); | |
if(n==0) | |
break; | |
for(i=1;i<=n;i++){ | |
scanf("%ld",&a[i]); | |
} | |
for(j=1;j<=n;j++){ | |
b[j]=j; | |
} | |
for(i=1;i<=n;i++){ | |
j=a[i]; | |
c[j]=b[i]; | |
} | |
for(i=1;i<=n;i++){ | |
if(a[i]!=c[i]) | |
break; | |
} | |
if(i>n){ | |
printf("ambiguous\n"); | |
} | |
else printf("not ambiguous\n"); | |
} | |
return 0; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
int main(){ | |
int i=0,j,c,b,t,k; | |
int a[10001]; | |
scanf("%d%d",&c,&b); | |
i=abs(c-b); | |
j=0; | |
//printf("i--/.%d\n",i); | |
while(i){ | |
t=i%10; | |
a[j]=t; | |
i=i/10; | |
//printf("%d ,%d\t",a[j],t); | |
j++; | |
} | |
//printf("j last---%d",j); | |
t=3; | |
printf("%d",t); | |
for(k=j-2;k>=0;k--){ | |
printf("%d",a[k]); | |
} | |
return 0; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
long int dist(long int ,long int,long int ,long int); | |
int main(){ | |
int i,j,a[100],n,r; | |
long int x1,x2,y1,y2,x3,y3,r1,r2,r3; | |
scanf("%d",&n); | |
for(i=0;i<n;i++){ | |
scanf("%d",&r); | |
scanf("%d%d",&x1,&y1); | |
scanf("%d%d",&x2,&y2); | |
scanf("%d%d",&x3,&y3); | |
r1=dist(x1,y1,x2,y2); | |
r2=dist(x2,y2,x3,y3); | |
r3=dist(x1,y1,x3,y3); | |
if((r1<=r&&r2<=r)||(r2<=r&&r3<=r)||(r1<=r&&r3<=r)) | |
printf("yes\n"); | |
else printf("no\n"); | |
} | |
return 0; | |
} | |
long int dist(long int x1,long int y1,long int x2,long int y2){ | |
long int s=0; | |
s=pow((x1-x2),2)+pow((y1-y2),2); | |
return ceil(sqrt(s)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
long int dist(long int ,long int,long int ,long int); | |
int main(){ | |
int i,j,a[100],n,r; | |
long int x1,x2,y1,y2,x3,y3,r1,r2,r3; | |
scanf("%d",&n); | |
for(i=0;i<n;i++){ | |
scanf("%d",&r); | |
scanf("%d%d",&x1,&y1); | |
scanf("%d%d",&x2,&y2); | |
scanf("%d%d",&x3,&y3); | |
r1=dist(x1,y1,x2,y2); | |
r2=dist(x2,y2,x3,y3); | |
r3=dist(x1,y1,x3,y3); | |
if((r1<=r&&r2<=r)||(r2<=r&&r3<=r)||(r1<=r&&r3<=r)) | |
printf("yes\n"); | |
else printf("no\n"); | |
} | |
return 0; | |
} | |
long int dist(long int x1,long int y1,long int x2,long int y2){ | |
long int s=0; | |
s=pow((x1-x2),2)+pow((y1-y2),2); | |
return ceil(sqrt(s)); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
int main(){ | |
int i,j,n,a[100][10],t,k,count=0; | |
scanf("%d",&n); | |
for(i=0;i<n;i++){ | |
for(j=0;j<10;j++){ | |
scanf("%d",&a[i][j]); | |
} | |
if(a[i][0]==0){ | |
printf("\n%d first bit zero ,canot represent",10); | |
//j++; | |
} | |
else if(while(a[i][j]!=0)){ | |
int w=0; | |
//for(j=1;j<10;j++){ | |
j=1; | |
while(w!=10){ | |
if(a[i][j]==0){ | |
t=j; | |
printf("%d-canot present,",j); | |
break; | |
} | |
j++; | |
w++; | |
} | |
} | |
else if(1){ | |
int w=0,j=1; | |
while(w!=10){ | |
if(a[i][j]==1){ | |
printf("last--%d canot ",(j*10+j)); | |
break; | |
} | |
j++; | |
w++; | |
} | |
} | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<string.h> | |
#include<stdlib.h> | |
int main(){ | |
int count; | |
int n,i,j,p; | |
char b[41][100]; | |
//char a[]={'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}; | |
//char hl[]={'A','B','D','O','P','Q','R'}; | |
scanf("%d",&n); | |
for(i=0;i<=n;i++){ | |
gets(b[i]); | |
} | |
for(i=1;i<=n;i++){ | |
count=0; | |
p=strlen(b[i]); | |
for(j=0;j<p ;j++){ | |
if((b[i][j]=='A'|| b[i][j]=='D'|| b[i][j]=='O'|| b[i][j]=='P'|| b[i][j]=='Q'|| b[i][j]=='R')) | |
count++; | |
if(b[i][j]=='B') | |
count=count+2; | |
} | |
printf("%d\n",count); | |
count=0; | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class firstJavaProg{ | |
public static void main(String[] args){ | |
System.out.println("This is my first java prog"); | |
} | |
Microsoft Windows [Version 6.1.7601] | |
Copyright (c) 2009 Microsoft Corporation. All rights reserved. | |
C:\Users\DELL>E: | |
E:\>cd javaPrograms | |
E:\javaPrograms>dir | |
Volume in drive E is MUKESH DANGI | |
Volume Serial Number is 345C-DB59 | |
Directory of E:\javaPrograms | |
08/04/2012 03:05 AM <DIR> . | |
08/04/2012 03:05 AM <DIR> .. | |
08/04/2012 03:05 AM 132 firstJavaProg.java | |
08/04/2012 03:02 AM 44 jp.bat | |
2 File(s) 176 bytes | |
2 Dir(s) 15,315,107,840 bytes free | |
E:\javaPrograms>jp.bat | |
E:\javaPrograms>PATH="C:\Program Files\Java\jdk1.7.0_03\bin" | |
E:\javaPrograms>javac firstJavaProg.java | |
E:\javaPrograms>java firstJavaProg | |
This is my first java prog | |
E:\javaPrograms> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
long double fect(int a){ | |
long double s=1; | |
int i; | |
for(i=1;i<=a;i++){ | |
s=s*i; | |
} | |
return s; | |
} | |
int main(){ | |
int i=0,t,n; | |
long double j; | |
scanf("%d\n",&t); | |
for(;i<t;i++){ | |
scanf("%d\n",&n); | |
j=fect(n); | |
printf("%ld",j); | |
} | |
return 0; | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<string.h> | |
#include<stdlib.h> | |
int main(){ | |
int i,j,l=0,k; | |
char *t,*s; | |
char a[100001],b[1000001],st[100001]; | |
printf("\nEnter the string :"); | |
gets(st); | |
l=strlen(st); | |
s=(char*)malloc(sizeof(char*)*l); | |
t=(char*)malloc(sizeof(char*)*l); | |
strcpy(t,st); | |
int r=l; | |
for(i=0;i<l/2;i++){ | |
//while(){ | |
for(j=0;j<l;j++){ | |
for(k=j;k<=j;k++){ | |
b[k+j]=t[k]; | |
} | |
printf("%s\t",b); | |
} | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment