标签:style blog http io ar color os 使用 sp
我只能说,珍爱生命,远离卡常数的题。。。感谢陈老师和蔡神,没有他们,,,我调一个星期都弄不出来,,,,
描述
输入
输出
样例输入
样例输出
题目来源
5954 | njczy2010 | G | Accepted | 12656 KB | 921 ms | GCC | 2612 B | 2014-11-27 22:08:52 |
5953 | njczy2010 | G | Accepted | 12656 KB | 890 ms | G++ | 2823 B | 2014-11-27 22:07:44 |
5951 | njczy2010 | G | Accepted | 12656 KB | 921 ms | GCC | 2823 B | 2014-11-27 22:05:53 |
5949 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 3044 B | 2014-11-27 21:55:45 | ||
5948 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 3146 B | 2014-11-27 21:53:51 | ||
5947 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 3150 B | 2014-11-27 21:47:58 | ||
5946 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 2751 B | 2014-11-27 21:13:15 | ||
5924 | njczy2010 | G | Accepted | 9312 KB | 750 ms | GCC | 2223 B | 2014-11-27 16:23:23 |
5918 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 3162 B | 2014-11-27 16:14:19 | ||
5917 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 2967 B | 2014-11-27 16:08:09 | ||
5916 | njczy2010 | G | Compile Error | GCC | 2965 B | 2014-11-27 16:07:51 | ||
5915 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 2851 B | 2014-11-27 16:05:25 | ||
5913 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 2806 B | 2014-11-27 16:03:56 | ||
5911 | njczy2010 | G | Accepted | 9312 KB | 859 ms | G++ | 2215 B | 2014-11-27 15:53:04 |
5909 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2996 B | 2014-11-27 15:52:13 | ||
5908 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2692 B | 2014-11-27 15:26:46 | ||
5864 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2482 B | 2014-11-27 11:57:07 | ||
5863 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2428 B | 2014-11-27 11:55:09 | ||
5862 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2416 B | 2014-11-27 11:50:31 | ||
5861 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2406 B | 2014-11-27 11:44:55 |
这是水过去的代码:
1 #include<stdio.h> 2 3 //#include<pair> 4 5 #define N 20 6 #define M 1005 7 #define mod 1000000007 8 //#define p 10000007 9 #define mod2 1000000000 10 #define ll long long 11 #define LL long long 12 #define eps 1e-9 13 #define maxi(a,b) (a)>(b)? (a) : (b) 14 #define mini(a,b) (a)<(b)? (a) : (b) 15 16 int m; 17 int x[N][N]; 18 double p[N],a[N],n[N],y[N][N]; 19 double zhe[ 32768 ][N]; 20 double ans; 21 double dp[ 32768 ]; 22 double tta[ 32768 ]; 23 int tot; 24 double zhezhe[N][N]; 25 int pos[ 32768 ]; 26 int son[ 32768 ]; 27 int pos2[ 32768 ][ 17 ]; 28 int cnt2[ 32768 ]; 29 int son2[ 32768 ][ 17 ]; 30 int h[16]; 31 char ss[17]; 32 int bit[32768][16]; 33 34 void ini1() 35 { 36 int i,o,j,k,ch; 37 38 h[0]=1; 39 for(i=1;i<16;i++) 40 h[i]=2*h[i-1]; 41 for(o=0;o<32768;o++){ 42 k=o; 43 j=0; 44 ch=1; 45 while(k > 0){ 46 bit[i][j] = k%2; 47 k = k/2; 48 j++; 49 } 50 for(j=0;j<15;j++) 51 { 52 if(bit[i][j]==0) 53 { 54 pos2[o][ cnt2[o] ]=j; 55 cnt2[o]++; 56 } 57 else 58 { 59 if(ch==1) 60 { 61 ch=0; 62 pos[o]=j; 63 son[o]= o - h[j]; 64 } 65 } 66 } 67 } 68 } 69 70 void ini() 71 { 72 ans=1000000000; 73 int i,j; 74 int o; 75 tot=h[m]; 76 for(i=1;i<=m;i++){ 77 for(j=1;j<=m;j++){ 78 zhezhe[i][j]=1.0; 79 } 80 scanf("%lf%lf%lf",&p[i],&a[i],&n[i]); 81 for(j=1;j<=n[i];j++){ 82 scanf("%d%lf",&x[i][j],&y[i][j]); 83 y[i][j]=(100.0-y[i][j])/100.0; 84 zhezhe[i][ x[i][j] ]=y[i][j]; 85 } 86 } 87 88 for(o=0;o<tot;o++){ 89 dp[o]=1000000000; 90 91 } 92 for(j=1;j<=m;j++){ 93 zhe[0][j]=1.0; 94 } 95 tta[0]=0.0; 96 } 97 98 void solve() 99 { 100 int o,k,kk,j; 101 int te; 102 dp[0]=0; 103 for(o=0;o<tot;o++){ 104 if(o>=1){ 105 j=pos[o]+1; 106 te=son[o]; 107 tta[o]=tta[te]+a[j]; 108 109 for(kk=0;kk<cnt2[o];kk++){ 110 k=pos2[o][kk]+1; 111 zhe[o][k]=zhe[te][k]*zhezhe[j][k]; 112 } 113 } 114 115 for(kk=0;kk<cnt2[o];kk++){ 116 k=pos2[o][kk]+1; 117 te=o+h[k-1]; 118 dp[te]=mini(dp[te],dp[o]+p[k]*zhe[o][k] ); 119 } 120 } 121 } 122 123 void out() 124 { 125 int o; 126 for(o=1;o<tot;o++){ 127 //printf(" o=%d dp=%.4f\n",o,dp[o]); 128 ans=mini(ans,dp[o]/tta[o]); 129 } 130 printf("%.4f\n",ans); 131 } 132 133 int main() 134 { 135 ini1(); 136 // freopen("data.in","r",stdin); 137 //freopen("data.out","w",stdout); 138 while(scanf("%d",&m)!=EOF) 139 { 140 if( m==0 ) break; 141 142 ini(); 143 solve(); 144 out(); 145 } 146 147 return 0; 148 }
RunID | User | Problem | Result | Memory | Time | Language | Length | Submit Time |
---|---|---|---|---|---|---|---|---|
5860 | njczy2010 | G | Accepted | 9312 KB | 734 ms | GCC | 2215 B | 2014-11-27 11:44:14 |
5859 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 2215 B | 2014-11-27 11:43:42 | ||
5858 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2404 B | 2014-11-27 11:36:29 | ||
5857 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3036 B | 2014-11-27 11:24:57 | ||
5856 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3466 B | 2014-11-27 11:13:39 | ||
5854 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3413 B | 2014-11-27 11:07:27 | ||
5849 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3722 B | 2014-11-27 10:23:56 | ||
5848 | njczy2010 | G | Compile Error | G++ | 3716 B | 2014-11-27 10:23:19 | ||
5847 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3330 B | 2014-11-27 10:12:09 | ||
5846 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3322 B | 2014-11-27 10:09:51 | ||
5845 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3323 B | 2014-11-27 10:08:35 | ||
5844 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 3156 B | 2014-11-27 10:05:04 | ||
5842 | njczy2010 | G | Time Limit Exceed at Test 1 | GCC | 2916 B | 2014-11-26 23:30:18 | ||
5841 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2986 B | 2014-11-26 23:23:18 | ||
5840 | njczy2010 | G | Wrong Answer at Test 1 | G++ | 2986 B | 2014-11-26 23:22:42 | ||
5839 | njczy2010 | G | Wrong Answer at Test 1 | G++ | 2984 B | 2014-11-26 23:19:33 | ||
5838 | njczy2010 | G | Wrong Answer at Test 1 | G++ | 2982 B | 2014-11-26 23:18:46 | ||
5837 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2981 B | 2014-11-26 23:07:33 | ||
5836 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2715 B | 2014-11-26 22:58:10 | ||
5830 | njczy2010 | G | Time Limit Exceed at Test 1 | G++ | 2167 B | 2014-11-26 22:28:24 |
NOJ 1116 哈罗哈的大披萨 【淡蓝】 [状压dp+各种优化]
标签:style blog http io ar color os 使用 sp
原文地址:http://www.cnblogs.com/njczy2010/p/4127344.html