HDU 5095--Linearization of the kernel functions in SVM【模拟】
Linearization of the kernel functions in SVM
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 2232 Accepted Submission(s): 598
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.
j of the function f(x,y,z) = ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + iz + j.
2
0 46 3 4 -5 -22 -8 -32 24 27
2 31 -5 0 0 12 0 0 -49 12
46q+3r+4u-5v-22w-8x-32y+24z+27
2p+31q-5r+12w-49z+12
最烦做的就是模拟题 ,恶心啊。。。
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>
#include <stack>
#include <iostream>
using namespace std; char str[] = {'p', 'q', 'r', 'u', 'v', 'w', 'x', 'y', 'z', '\0'};
int a[15]; int main (){
int T;
scanf("%d", &T);
while(T--){
for(int i = 0; i < 10; ++i)
scanf("%d", &a[i]);
int ans = 0;
int flag = 0;
for(int i = 0; i < 9; ++i){ if(a[i] == 0) continue;
if(a[i] == 1 ){
if(flag)
printf("+");
else
flag++;
printf("%c", str[i]);
continue;
}
if(a[i] == -1){
printf("-%c", str[i]);
flag++;
continue;
}
if(a[i] > 0){
if(flag)
printf("+");
else
flag++;
printf("%d%c", a[i], str[i]);
}
else
printf("%d%c", a[i], str[i]), flag++;
}
if(a[9] > 0){
if(flag)
printf("+");
else
flag++;
printf("%d", a[9]);
}
else if( a[9] < 0){
flag ++;
printf("%d", a[9]);
}
if(!flag)
printf("0");
printf("\n");
}
return 0;
}
HDU 5095--Linearization of the kernel functions in SVM【模拟】的更多相关文章
- HDU 5095 Linearization of the kernel functions in SVM(模拟)
主题链接:http://acm.hdu.edu.cn/showproblem.php? pid=5095 Problem Description SVM(Support Vector Machine) ...
- HDU 5095 Linearization of the kernel functions in SVM (坑水)
比较坑的水题,首项前面的符号,-1,+1,只有数字项的时候要输出0. 感受一下这些数据 160 0 0 0 0 0 0 0 0 -10 0 0 0 0 0 0 0 0 10 0 0 0 0 0 0 0 ...
- hdu 5095 Linearization of the kernel functions in SVM(模拟,分类清楚就行)
题意: INPUT: The input of the first line is an integer T, which is the number of test data (T<120). ...
- 模拟 HDOJ 5095 Linearization of the kernel functions in SVM
题目传送门 /* 题意:表达式转换 模拟:题目不难,也好理解题意,就是有坑!具体的看测试样例... */ #include <cstdio> #include <algorithm& ...
- Linearization of the kernel functions in SVM(多项式模拟)
Description SVM(Support Vector Machine)is an important classification tool, which has a wide range o ...
- Kernel Functions for Machine Learning Applications
In recent years, Kernel methods have received major attention, particularly due to the increased pop ...
- SVM Kernel Functions
==================================================================== This article came from here. Th ...
- Kernel Functions-Introduction to SVM Kernel & Examples - DataFlair
Kernel Functions-Introduction to SVM Kernel & Examples - DataFlairhttps://data-flair.training/bl ...
- hdu 5095 多项式模拟+有坑
http://acm.hdu.edu.cn/showproblem.php?pid=5095 就是把ax^2 + by^2 + cy^2 + dxy + eyz + fzx + gx + hy + i ...
随机推荐
- switch语句以及三种循环语句的总结
1:switch语句(1)格式:switch(表达式) {case 值1:语句体1;break;case 值2:语句体2;break;...default:语句体n+1;break;} 格式解释说明: ...
- SpringBoot文件上传下载
项目中经常会有上传和下载的需求,这篇文章简述一下springboot项目中实现简单的上传和下载. 新建springboot项目,前台页面使用的thymeleaf模板,其余的没有特别的配置,pom代码如 ...
- Android 一个Activity 里面放置多个 Fragment 实现点击切换的Tab 页面效果
// BaseActivity 是实现的一些公共的变量和方法,可以暂时为空的类 public class HomeActivity extends BaseActivity implements Vi ...
- PPT设计宝典!十招教你做出拿手的PPT
据说上班用 excel 的比 word 的工资高,用 ppt 的比用 excel 的工资高.无论如何,在职场演讲汇报中,PPT 扮演着至关重要的角色. 在本文我们将用 10 个超级技巧来解决糟糕的演 ...
- BZOJ4858 : [Jsoi2016]炸弹攻击 2
枚举每个$S$作为原点,将所有$D$和$T$极角排序. 枚举每个$T$,那么另一个$T$需要和当前的$T$夹角不超过$180$度,贡献为内部$D$的个数. 双指针后用前缀和查询区间的贡献即可. 时间复 ...
- Python实现图像信息隐藏
Python实现图像信息隐藏 之前学习密码学的时候老师有提到过『信息隐藏』,现在用图像的方法尝试一下.思想是:把信息藏到RGB通道中的B通道,然后利用奇偶性可以恢复过来 原理 从源图中提取文字图像信息 ...
- Spring MVC4 + Spring Security4 + Hibernate实例
http://www.yiibai.com/spring-security/spring-mvc-4-and-spring-security-4-integration-example.html 在这 ...
- python之封装
封装的主要原因是保护隐私,隔离复杂度 封装分为两个层面: 第一个层面的封装(什么都不用做):创建类和对象会分别创建二者的名称精简,我们只能用类名.或者obj.的方式去访问里面的名字,这本身就是一种分装 ...
- 【并查集】Connectivity @ABC049&ARC065/upcexam6492
Connectivity 时间限制: 1 Sec 内存限制: 128 MB 题目描述 There are N cities. There are also K roads and L railway ...
- pygame 笔记-4 代码封装&发射子弹
继续之前的内容,随着游戏的内容越来越复杂,有必要把代码优化一下,可以参考OOP的做法,把人物类抽象出来,弄成一个单独的类,这们便于代码维护,同时我们给小人儿,加个发射子弹的功能,代码如下:(看上去略长 ...