hdu 5095 Linearization of the kernel functions in SVM (简单模拟)
来源:互联网 发布:软件外包人员保密协议 编辑:程序博客网 时间:2024/05/21 06:32
Linearization of the kernel functions in SVM
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2227 Accepted Submission(s): 595
Problem Description
SVM(Support Vector Machine)is an important classification tool, which has a wide range of applications in cluster analysis, community division and so on. SVM The kernel functions used in SVM have many forms. Here we only discuss the function of the form f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j. By introducing new variables p, q, r, u, v, w, the linearization of the function f(x,y,z) is realized by setting the correspondence x^2<-> p, y^2 <-> q, z^2 <-> r, xy<-> u, yz <-> v, zx <-> w and the function f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j can be written as g(p,q,r,u,v,w,x,y,z) = ap + bq + cr + du + ev + fw + gx + hy + iz + j, which is a linear function with 9 variables.
Now your task is to write a program to change f into g.
Now your task is to write a program to change f into g.
Input
The input of the first line is an integer T, which is the number of test data (T<120). Then T data follows. For each data, there are 10 integer numbers on one line, which are the coefficients and constant a, b, c, d, e, f, g, h, i, j of the function f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j.
Output
For each input function, print its correspondent linear function with 9 variables in conventional way on one line.
Sample Input
20 46 3 4 -5 -22 -8 -32 24 272 31 -5 0 0 12 0 0 -49 12
Sample Output
46q+3r+4u-5v-22w-8x-32y+24z+272p+31q-5r+12w-49z+12
Source
2014上海全国邀请赛——题目重现(感谢上海大学提供题目)
虽说是简单模拟,但是有点小坑
中间的规则:
1、第一个字母前面的系数如果是正数则不需要输出‘+’;
2、如果系数是1或-1,那么对于前九项的系数不输出1只有‘+’或‘-’,常数则正常输出;
3、如果全部为0时应该输出0,不应该什么也不输出;
4、如果前九项的系数为0,最后常数的系数为一个正数,则不需要输出‘+’;*/
#include<stdio.h>#include<string.h>char ss[9]={'p','q','r','u','v','w','x','y','z'};int main(){int n;int map[15];scanf("%d",&n);while(n--){for(int i=0;i<10;i++){scanf("%d",&map[i]);}int count=0; for(int i=0;i<9;i++) { if(map[i]==0) { count++; continue; } if(map[i]>0) { if(count==i) //前边都是零 { if(map[i]==1) { printf("%c",ss[i]); } else { printf("%d%c",map[i],ss[i]); } } else { if(map[i]==1) { printf("+%c",ss[i]); } else { printf("+%d%c",map[i],ss[i]); } } } else if(map[i]<0) { if(count==i) //前边都是零 { if(map[i]==-1) { printf("-%c",ss[i]); } else { printf("%d%c",map[i],ss[i]); } } else { if(map[i]==-1) { printf("-%c",ss[i]); } else { printf("%d%c",map[i],ss[i]); } } } } if(count==9) { if(map[9]==0) { printf("0\n"); continue; } else { printf("%d\n",map[9]); continue; } } else { if(map[9]==0) { printf("\n"); continue; } else { if(map[9]>0) printf("+%d\n",map[9]); else printf("%d\n",map[9]);continue; } } }return 0;}
0 0
- hdu 5095 Linearization of the kernel functions in SVM(模拟)
- HDU 5095--Linearization of the kernel functions in SVM【模拟】
- HDU 5095 Linearization of the kernel functions in SVM【模拟】
- hdu 5095 Linearization of the kernel functions in SVM (简单模拟)
- hdoj 5095 Linearization of the kernel functions in SVM 【模拟】
- 【瞎搞】 HDU 5095 Linearization of the kernel functions in SVM
- hdu 5095 Linearization of the kernel functions in SVM(水题)
- HDU 5095 - Linearization of the kernel functions in SVM
- HDU 5095 Linearization of the kernel functions in SVM
- HDU 5095 Linearization of the kernel functions in SVM
- HDU 5095 Linearization of the kernel functions in SVM(模拟)
- HDU 5095 Linearization of the kernel functions in SVM(模拟, 水题)
- HDU 5095 Linearization of the kernel functions in SVM(模拟)
- hdu 5095 Linearization of the kernel functions in SVM(模拟)
- hdu 5095 Linearization of the kernel functions in SVM(模拟)
- HDU5095 Linearization of the kernel functions in SVM(模拟)
- Linearization of the kernel functions in SVM
- Linearization of the kernel functions in SVM
- 优势与应用:再谈CDN镜像加速技术
- 一点点bat 批处理文件 总结
- Unity3D研究院之共享材质的巧妙用法(修改renderQueue 必须看看这个)
- JSP页面间的参数传递
- SSH框架的应用介绍(spring、struts、hibernate) ---阿冬专栏
- hdu 5095 Linearization of the kernel functions in SVM (简单模拟)
- 每日金銀速遞
- 如何停止处于stopping状态的windows服务
- c++线程池
- Windows下编译 32位和64位 OpenSSL 2016-04-12
- 开发板sqlite数据库的搭建
- Java 删除文件或文件夹
- PHPthinking编程工具正式版发布
- 面向对象和面向组件的区别