爆我 long long

还是我太天真了!!!
P1033整数分解(版本2)Wrong Answer
记录信息
评测状态 Wrong Answer
题目 P1033 整数分解(版本2)
递交时间 2015-08-31 09:42:59
代码语言 C++
评测机 VijosEx
消耗时间 531 ms
消耗内存 572 KiB
评测时间 2015-08-31 09:43:01
评测结果
编译成功

foo.cpp: In function 'int main()':
foo.cpp:20:25: warning: unknown conversion type character 'l' in format [-Wformat=]
printf("%lld",work(1,n));
^
foo.cpp:20:25: warning: too many arguments for format [-Wformat-extra-args]
测试数据 #0: WrongAnswer, time = 15 ms, mem = 560 KiB, score = 0
测试数据 #1: WrongAnswer, time = 16 ms, mem = 572 KiB, score = 0
测试数据 #2: WrongAnswer, time = 40 ms, mem = 564 KiB, score = 0
测试数据 #3: WrongAnswer, time = 0 ms, mem = 528 KiB, score = 0
测试数据 #4: Accepted, time = 0 ms, mem = 528 KiB, score = 2
测试数据 #5: WrongAnswer, time = 2 ms, mem = 536 KiB, score = 0
测试数据 #6: WrongAnswer, time = 13 ms, mem = 536 KiB, score = 0
测试数据 #7: Accepted, time = 0 ms, mem = 532 KiB, score = 2
测试数据 #8: WrongAnswer, time = 0 ms, mem = 528 KiB, score = 0
测试数据 #9: WrongAnswer, time = 15 ms, mem = 564 KiB, score = 0
测试数据 #10: WrongAnswer, time = 1 ms, mem = 540 KiB, score = 0
测试数据 #11: WrongAnswer, time = 0 ms, mem = 536 KiB, score = 0
测试数据 #12: WrongAnswer, time = 0 ms, mem = 544 KiB, score = 0
测试数据 #13: WrongAnswer, time = 15 ms, mem = 532 KiB, score = 0
测试数据 #14: WrongAnswer, time = 23 ms, mem = 560 KiB, score = 0
测试数据 #15: WrongAnswer, time = 15 ms, mem = 536 KiB, score = 0
测试数据 #16: WrongAnswer, time = 15 ms, mem = 540 KiB, score = 0
测试数据 #17: WrongAnswer, time = 15 ms, mem = 552 KiB, score = 0
测试数据 #18: WrongAnswer, time = 0 ms, mem = 528 KiB, score = 0
测试数据 #19: WrongAnswer, time = 31 ms, mem = 560 KiB, score = 0
测试数据 #20: WrongAnswer, time = 15 ms, mem = 540 KiB, score = 0
测试数据 #21: WrongAnswer, time = 15 ms, mem = 560 KiB, score = 0
测试数据 #22: WrongAnswer, time = 15 ms, mem = 556 KiB, score = 0
测试数据 #23: WrongAnswer, time = 15 ms, mem = 548 KiB, score = 0
测试数据 #24: WrongAnswer, time = 5 ms, mem = 532 KiB, score = 0
测试数据 #25: WrongAnswer, time = 0 ms, mem = 544 KiB, score = 0
测试数据 #26: WrongAnswer, time = 20 ms, mem = 556 KiB, score = 0
测试数据 #27: WrongAnswer, time = 15 ms, mem = 548 KiB, score = 0
测试数据 #28: WrongAnswer, time = 0 ms, mem = 540 KiB, score = 0
测试数据 #29: WrongAnswer, time = 15 ms, mem = 552 KiB, score = 0
测试数据 #30: WrongAnswer, time = 15 ms, mem = 536 KiB, score = 0
测试数据 #31: WrongAnswer, time = 15 ms, mem = 536 KiB, score = 0
测试数据 #32: WrongAnswer, time = 15 ms, mem = 536 KiB, score = 0
测试数据 #33: Accepted, time = 0 ms, mem = 528 KiB, score = 2
测试数据 #34: WrongAnswer, time = 0 ms, mem = 540 KiB, score = 0
测试数据 #35: WrongAnswer, time = 0 ms, mem = 528 KiB, score = 0
测试数据 #36: WrongAnswer, time = 0 ms, mem = 532 KiB, score = 0
测试数据 #37: WrongAnswer, time = 0 ms, mem = 548 KiB, score = 0
测试数据 #38: WrongAnswer, time = 15 ms, mem = 552 KiB, score = 0
测试数据 #39: Accepted, time = 0 ms, mem = 528 KiB, score = 2
测试数据 #40: Accepted, time = 15 ms, mem = 532 KiB, score = 2
测试数据 #41: WrongAnswer, time = 15 ms, mem = 544 KiB, score = 0
测试数据 #42: WrongAnswer, time = 15 ms, mem = 536 KiB, score = 0
测试数据 #43: WrongAnswer, time = 15 ms, mem = 560 KiB, score = 0
测试数据 #44: WrongAnswer, time = 15 ms, mem = 560 KiB, score = 0
测试数据 #45: Accepted, time = 0 ms, mem = 528 KiB, score = 2
测试数据 #46: WrongAnswer, time = 15 ms, mem = 564 KiB, score = 0
测试数据 #47: WrongAnswer, time = 11 ms, mem = 544 KiB, score = 0
测试数据 #48: WrongAnswer, time = 24 ms, mem = 560 KiB, score = 0
测试数据 #49: Accepted, time = 15 ms, mem = 528 KiB, score = 2
WrongAnswer, time = 531 ms, mem = 572 KiB, score = 14
代码
#include <iostream>
#include <stdio.h>
using namespace std;
long long f[1600];
long long work(int le,int ri)
{
if(f[ri-le+1]!=0)return f[ri-le+1];
if(ri-le+1<=4)return f[ri-le+1]=ri-le+1;
long long maxans=-1;
for(int i=le+1;i<ri-1;i++)
{
maxans=max(maxans,work(le,i)*work(i+1,ri));
}
return f[ri-le+1]=maxans;
}
int main()
{
int n;
scanf("%d",&n);
printf("%lld",work(1,n));
}

终于对了

P1033整数分解(版本2)Accepted
记录信息
评测状态 Accepted
题目 P1033 整数分解(版本2)
递交时间 2015-09-01 21:31:24
代码语言 C++
评测机 VijosEx
消耗时间 312 ms
消耗内存 524 KiB
评测时间 2015-09-01 21:31:27
评测结果
编译成功

测试数据 #0: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #1: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #2: Accepted, time = 15 ms, mem = 516 KiB, score = 2
测试数据 #3: Accepted, time = 23 ms, mem = 520 KiB, score = 2
测试数据 #4: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #5: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #6: Accepted, time = 1 ms, mem = 516 KiB, score = 2
测试数据 #7: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #8: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #9: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #10: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #11: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #12: Accepted, time = 3 ms, mem = 520 KiB, score = 2
测试数据 #13: Accepted, time = 21 ms, mem = 520 KiB, score = 2
测试数据 #14: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #15: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #16: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #17: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #18: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #19: Accepted, time = 1 ms, mem = 516 KiB, score = 2
测试数据 #20: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #21: Accepted, time = 0 ms, mem = 524 KiB, score = 2
测试数据 #22: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #23: Accepted, time = 15 ms, mem = 516 KiB, score = 2
测试数据 #24: Accepted, time = 15 ms, mem = 516 KiB, score = 2
测试数据 #25: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #26: Accepted, time = 1 ms, mem = 516 KiB, score = 2
测试数据 #27: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #28: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #29: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #30: Accepted, time = 2 ms, mem = 516 KiB, score = 2
测试数据 #31: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #32: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #33: Accepted, time = 15 ms, mem = 516 KiB, score = 2
测试数据 #34: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #35: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #36: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #37: Accepted, time = 1 ms, mem = 520 KiB, score = 2
测试数据 #38: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #39: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #40: Accepted, time = 15 ms, mem = 516 KiB, score = 2
测试数据 #41: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #42: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #43: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #44: Accepted, time = 0 ms, mem = 520 KiB, score = 2
测试数据 #45: Accepted, time = 1 ms, mem = 520 KiB, score = 2
测试数据 #46: Accepted, time = 0 ms, mem = 516 KiB, score = 2
测试数据 #47: Accepted, time = 1 ms, mem = 520 KiB, score = 2
测试数据 #48: Accepted, time = 15 ms, mem = 520 KiB, score = 2
测试数据 #49: Accepted, time = 47 ms, mem = 516 KiB, score = 2
Accepted, time = 312 ms, mem = 524 KiB, score = 100
代码
#include <iostream>
#include <stdio.h>
using namespace std;
int ans[1001];
int num[3];
int main()
{
int n;
scanf("%d",&n);
if(n==1){
printf("1");
return 0;
}
if(n==2){
printf("2");
return 0;
}
num[2]=1;
for(int i=3;i<n;i++)
{
if(num[1]==0)
{
num[2]-=1;
num[1]+=2;
}
else
{
num[1]-=1;
num[2]+=1;
}
}
ans[1]=1;
ans[0]=1;
for(int i=1;i<=num[2];i++)
{
int j,in=0;
for(j=1;j<=ans[0]||in;j++)
{
int now=ans[j]*3+in;
ans[j]=now%10;
in=now/10;
}
if(j-1>ans[0])
ans[0]=j-1;
}
for(int i=1;i<=num[1];i++)
{
int j,in=0;
for(j=1;j<=ans[0]||in;j++)
{
int now=ans[j]*2+in;
ans[j]=now%10;
in=now/10;
}
if(j-1>ans[0])
ans[0]=j-1;
}
for(int i=ans[0];i>=1;i--)
printf("%d",ans[i]);
}

0 条评论

目前还没有评论...

信息

ID
1033
难度
5
分类
其他 | 数学 点击显示
标签
(无)
递交数
3722
已通过
1204
通过率
32%
被复制
9
上传者