Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

原来可以往POJ上交内联汇编,只要用G++编译就可以了。

Posted by NeverWin at 2011-02-19 18:38:36 on Problem 3533
asm(
"	.file	\"3533.cpp\"\n"
"	.text\n"
"	.align 2\n"
"	.p2align 4,,15\n"
".globl __Z6lowbitRKi\n"
"	.def	__Z6lowbitRKi;	.scl	2;	.type	32;	.endef\n"
"__Z6lowbitRKi:\n"
"	pushl	%ebp\n"
"	movl	%esp, %ebp\n"
"	movl	8(%ebp), %eax\n"
"	popl	%ebp\n"
"	movl	(%eax), %eax\n"
"	movl	%eax, %edx\n"
"	negl	%edx\n"
"	andl	%edx, %eax\n"
"	ret\n"
"	.align 2\n"
"	.p2align 4,,15\n"
".globl __Z5multiii\n"
"	.def	__Z5multiii;	.scl	2;	.type	32;	.endef\n"
"__Z5multiii:\n"
"	pushl	%ebp\n"
"	movl	%esp, %ebp\n"
"	subl	$28, %esp\n"
"	movl	%ebx, -12(%ebp)\n"
"	movl	12(%ebp), %ebx\n"
"	movl	%edi, -4(%ebp)\n"
"	movl	8(%ebp), %edi\n"
"	movl	%esi, -8(%ebp)\n"
"	cmpl	%ebx, %edi\n"
"	movl	%edi, %eax\n"
"	jle	L3\n"
"	movl	%ebx, 8(%ebp)\n"
"	movl	%ebx, %edi\n"
"	movl	%eax, %ebx\n"
"	movl	%eax, 12(%ebp)\n"
"L3:\n"
"	xorl	%eax, %eax\n"
"	testl	%edi, %edi\n"
"	je	L2\n"
"	cmpl	$1, %edi\n"
"	movl	%ebx, %eax\n"
"	je	L2\n"
"	cltd\n"
"	movl	$2, %esi\n"
"	idivl	%esi\n"
"	cmpl	$2, %eax\n"
"	jmp	L24\n"
"	.p2align 4,,7\n"
"L29:\n"
"	imull	%esi, %esi\n"
"	movl	%ebx, %eax\n"
"	cltd\n"
"	idivl	%esi\n"
"	cmpl	%esi, %eax\n"
"L24:\n"
"	jge	L29\n"
"	cmpl	%esi, %ebx\n"
"	je	L30\n"
"	leal	12(%ebp), %edx\n"
"	movl	%edx, (%esp)\n"
"	call	__Z6lowbitRKi\n"
"	cmpl	%ebx, %eax\n"
"	je	L13\n"
"	movl	%eax, 4(%esp)\n"
"	movl	%edi, (%esp)\n"
"	call	__Z5multiii\n"
"	movl	%eax, %ebx\n"
"	leal	12(%ebp), %eax\n"
"	movl	%eax, (%esp)\n"
"	call	__Z6lowbitRKi\n"
"	movl	12(%ebp), %edx\n"
"	subl	%eax, %edx\n"
"	movl	8(%ebp), %eax\n"
"	movl	%edx, 4(%esp)\n"
"	movl	%eax, (%esp)\n"
"L27:\n"
"	call	__Z5multiii\n"
"	xorl	%ebx, %eax\n"
"	.p2align 4,,15\n"
"L2:\n"
"	movl	-12(%ebp), %ebx\n"
"	movl	-8(%ebp), %esi\n"
"	movl	-4(%ebp), %edi\n"
"	movl	%ebp, %esp\n"
"	popl	%ebp\n"
"	ret\n"
"L13:\n"
"	leal	8(%ebp), %edx\n"
"	movl	%edx, (%esp)\n"
"	call	__Z6lowbitRKi\n"
"	cmpl	%edi, %eax\n"
"	je	L14\n"
"	movl	%ebx, 4(%esp)\n"
"	movl	%eax, (%esp)\n"
"	call	__Z5multiii\n"
"	movl	%eax, %ebx\n"
"	leal	8(%ebp), %eax\n"
"	movl	%eax, (%esp)\n"
"	call	__Z6lowbitRKi\n"
"	movl	8(%ebp), %edx\n"
"	subl	%eax, %edx\n"
"	movl	12(%ebp), %eax\n"
"	movl	%edx, (%esp)\n"
"	movl	%eax, 4(%esp)\n"
"	jmp	L27\n"
"L30:\n"
"	cmpl	%esi, %edi\n"
"	je	L31\n"
"	movl	%edi, %eax\n"
"	imull	%esi, %eax\n"
"	jmp	L2\n"
"L14:\n"
"	movl	%edi, %eax\n"
"	movl	$2, %ecx\n"
"	cltd\n"
"	idivl	%ecx\n"
"	cmpl	$2, %eax\n"
"	movl	%eax, -20(%ebp)\n"
"	jmp	L25\n"
"	.p2align 4,,7\n"
"L32:\n"
"	imull	%ecx, %ecx\n"
"	movl	%edi, %eax\n"
"	cltd\n"
"	idivl	%ecx\n"
"	cmpl	%ecx, %eax\n"
"	movl	%eax, -20(%ebp)\n"
"L25:\n"
"	jge	L32\n"
"	cmpl	%ecx, %esi\n"
"	je	L33\n"
"	movl	%edi, (%esp)\n"
"	movl	%ebx, %eax\n"
"	cltd\n"
"	idivl	%esi\n"
"	movl	%eax, 4(%esp)\n"
"	call	__Z5multiii\n"
"	movl	%esi, 4(%esp)\n"
"L26:\n"
"	movl	%eax, (%esp)\n"
"	call	__Z5multiii\n"
"	jmp	L2\n"
"L33:\n"
"	movl	%ebx, %eax\n"
"	cltd\n"
"	idivl	%esi\n"
"	movl	%eax, 4(%esp)\n"
"	movl	%edi, %eax\n"
"	cltd\n"
"	idivl	%esi\n"
"	movl	%eax, (%esp)\n"
"	call	__Z5multiii\n"
"	movl	%esi, %edx\n"
"	sarl	%edx\n"
"	addl	%esi, %edx\n"
"	movl	%edx, 4(%esp)\n"
"	jmp	L26\n"
"L31:\n"
"	movl	%esi, %eax\n"
"	sarl	%eax\n"
"	addl	%esi, %eax\n"
"	jmp	L2\n"
"	.def	___main;	.scl	2;	.type	32;	.endef\n"
"	.section .rdata,\"dr\"\n"
"LC0:\n"
"	.ascii \"%d\\0\"\n"
"LC2:\n"
"	.ascii \"Yes\\0\"\n"
"LC1:\n"
"	.ascii \"%d%d%d\\0\"\n"
"LC3:\n"
"	.ascii \"No\\0\"\n"
"	.text\n"
"	.align 2\n"
"	.p2align 4,,15\n"
".globl _main\n"
"	.def	_main;	.scl	2;	.type	32;	.endef\n"
"_main:\n"
"	pushl	%ebp\n"
"	movl	$16, %eax\n"
"	movl	%esp, %ebp\n"
"	pushl	%edi\n"
"	pushl	%esi\n"
"	pushl	%ebx\n"
"	subl	$44, %esp\n"
"	andl	$-16, %esp\n"
"	call	__alloca\n"
"	call	___main\n"
"	leal	-24(%ebp), %edi\n"
"	leal	-28(%ebp), %eax\n"
"	movl	%eax, 4(%esp)\n"
"	movl	$LC0, (%esp)\n"
"	call	_scanf\n"
"	incl	%eax\n"
"	je	L52\n"
"	.p2align 4,,15\n"
"L43:\n"
"	xorl	%esi, %esi\n"
"	xorl	%ebx, %ebx\n"
"	cmpl	-28(%ebp), %esi\n"
"	jl	L40\n"
"L46:\n"
"	movl	$LC2, (%esp)\n"
"	call	_puts\n"
"L53:\n"
"	movl	$LC0, (%esp)\n"
"	leal	-28(%ebp), %eax\n"
"	movl	%eax, 4(%esp)\n"
"	call	_scanf\n"
"	incl	%eax\n"
"	jne	L43\n"
"L52:\n"
"	leal	-12(%ebp), %esp\n"
"	xorl	%eax, %eax\n"
"	popl	%ebx\n"
"	popl	%esi\n"
"	popl	%edi\n"
"	popl	%ebp\n"
"	ret\n"
"	.p2align 4,,7\n"
"L40:\n"
"	movl	%edi, 4(%esp)\n"
"	leal	-16(%ebp), %eax\n"
"	incl	%ebx\n"
"	movl	%eax, 12(%esp)\n"
"	leal	-20(%ebp), %eax\n"
"	movl	%eax, 8(%esp)\n"
"	movl	$LC1, (%esp)\n"
"	call	_scanf\n"
"	movl	-20(%ebp), %eax\n"
"	movl	%eax, 4(%esp)\n"
"	movl	-24(%ebp), %eax\n"
"	movl	%eax, (%esp)\n"
"	call	__Z5multiii\n"
"	movl	%eax, (%esp)\n"
"	movl	-16(%ebp), %edx\n"
"	movl	%edx, 4(%esp)\n"
"	call	__Z5multiii\n"
"	xorl	%eax, %esi\n"
"	cmpl	-28(%ebp), %ebx\n"
"	jl	L40\n"
"	testl	%esi, %esi\n"
"	je	L46\n"
"	movl	$LC3, (%esp)\n"
"	call	_puts\n"
"	jmp	L53\n"
"	.def	_puts;	.scl	2;	.type	32;	.endef\n"
"	.def	_scanf;	.scl	2;	.type	32;	.endef\n"
);

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator