Ejemplo n.º 1
0
Archivo: 1015.c Proyecto: OliverLew/PTA
int main()
{
    int N, D;

    while(scanf("%d %d", &N, &D) == 2)
        puts(iPrime(N) && iPrime(Rev(N, D)) ? "Yes" : "No");

    return 0;
}
int AddDecimal(int dpart, char *s, int start){
	dpart = Rev(dpart);
	int i = start;
	while (dpart != 0)
	{
		int digit = dpart % 10;
		s[i++] = digit + 48;
		dpart /= 10;
	}
	s[i] = '\0';
	return i;
}
int AddInt(int ipart, char *s, int nop){
	int i = 0;
	if (nop == 1){
		s[0] = '-';
		ipart = -ipart;
		i = 1;
	}
	ipart = Rev(ipart);

	while (ipart != 0){
		int digit = ipart % 10;
		s[i++] = digit + 48;
		ipart /= 10;
	}
	s[i] = '\0';
	return i;
}
void main()
{
	int ch;
	Stud *head=NULL;
	clrscr();
	while(ch!=0)
	{
		 printf("\n\n\t\t1. Add End\
				   \n\t\t2. Add Mid\
				   \n\t\t3. Display\
				   \n\t\t4. Delete Beg\ \
				   \n\t\t5. Rev\
				   \n\t\t6. Sort\
				   \n\t\t0. Exit\
				   \n\t Enter Your choice ");
		 scanf("%d",&ch);
		 switch(ch)
		 {
			case 1:
				  head=AddEnd(head);
				  break;
			case 3:

				  Display(head);
				  break;
			case 2:
				 {
				   int pos;
				   printf("\n\n\t Enter The Pos ");
				   scanf("%d",&pos);
				   head=AddMid(head,pos);
				  }
				  break;
			case 4:
			head=DelBeg(head);
			break;
			case 5:
				 head=Rev(head);
				 break;
			case 6:
				 head=Sort(head);
				 break;
		 }
	}
	getch();
}
Ejemplo n.º 5
0
int Rev(int N) { if (N<=9) return N; return Rev(N/10) + (N%10) * pow10[ digits(N)-1 ]; }
Ejemplo n.º 6
0
inline uint NODE(lzindex I, uint id)
 {
    if (!id) return 0;
    return Rev(I, getposRevTrie(I.bwdtrie,leftrankRevTrie(I.bwdtrie, RNODE(I,id))));
 }
Ejemplo n.º 7
0
inline uint RIDS(lzindex I, uint rpos)
 {
    return IDS(I, leftrankLZTrie(I.fwdtrie,Rev(I,rpos)));
 }
Ejemplo n.º 8
0
 void transpose_graph(const VertexListGraph& G, MutableGraph& G_T,
                      const bgl_named_params<P, T, R>& params)
 {
   reverse_graph<VertexListGraph> Rev(G);
   copy_graph(Rev, G_T, params);
 }