HDU 5095 Linearization of the kernel functions in SVM(模拟)
主题链接:http://acm.hdu.edu.cn/showproblem.php?
pid=5095
= ax^2 + by^2 + cz^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 + cz^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.
= ax^2 + by^2 + cz^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
pid=5098" style="color:rgb(26,92,200); text-decoration:none">5098
pid=5097" style="color:rgb(26,92,200); text-decoration:none">5097
5096pid=5094" style="color:rgb(26,92,200); text-decoration:none">5094
5093PS:
一道比較坑的模拟题。
注意1和-1 的情况。
代码例如以下:
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
int main()
{
int M;
int a[17];
char b[17] = {'#','p','q','r','u','v','w','x','y','z'};
scanf("%d",&M);
getchar();
while(M--)
{
for(int k = 1; k <= 10; k++)
{
scanf("%d",&a[k]);
}
int cont = 0;
int flag = 0;
for(int k = 1; k < 10; k++)
{
if(a[k]==0)
continue;
cont++;
if(cont == 1)
{
if(a[k] != 1 && a[k] != -1)
printf("%d%c",a[k],b[k]);
else if(a[k] == 1)
printf("%c",b[k]);
else if(a[k] == -1)
printf("-%c",b[k]);
flag = 1;
}
else
{
if(a[k] > 0)
printf("+");
if(a[k] != 1 && a[k] != -1)
printf("%d%c",a[k],b[k]);
else if(a[k] == 1)
printf("%c",b[k]);
else if(a[k] == -1)
printf("-%c",b[k]);
flag = 1;
}
}
if(a[10])
{
if(a[10] > 0 && flag)
printf("+");
printf("%d",a[10]);
flag = 1;
}
if(!flag)//没有答案
printf("0");
printf("\n");
}
return 0;
}
/*
99
0 0 0 0 0 0 0 0 0 -1
0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0
-1 0 0 0 0 0 0 0 0 0
-1 -1 -1 -41 -1 -1 -1 -1 -1 -1
-1 5 -2 0 0 0 0 0 0 0
1 1 1 1 1 1 1 1 1 1
-1 -1 -1 -1 -1 -1 -1 -1 -1 -1
0 0 0 0 0 -1 -1 -1 -1 -1
0 0 0 0 0 1 1 1 1 1
1 1 1 1 1 0 0 0 0 0
-1 -1 -1 -1 -1 0 0 0 0 0
1 1 1 1 1 1 1 1 1 0
*/
版权声明:本文博客原创文章。博客,未经同意,不得转载。
HDU 5095 Linearization of the kernel functions in SVM(模拟)的更多相关文章
- 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 ...
- 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: ...
- 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 ...
随机推荐
- .Net C# Windows Service于server无法启动,错误 193:0xc1
1.情况说明:的近期发展windows维修,当地win7系统正常.把server安装会失败. 图中的引导失败的例子.: 解决方法:执行->输入:eventvwr.msc 打开你的事件查看器 ...
- java 处理时间的各种方式——获取时间——时间格式化
TimeUtil.java package com.snow; import java.text.DateFormat; import java.text.ParseException; import ...
- SWT中的GridLayout(转)例子不错
GridLayout 是一个非常强大的布局管理器,它可以实现很多复杂的布局,名字中暗示它将所有控件放置在类似网格的布局中.^__^GridLayout 有两个构造函数. GridLayout的构造函数 ...
- JFinal开发8个常见问题
下面是8个最常见的问题总结. 1.Can not create instance of class: demo.DemoConfig. 觉得应该是你的路径有问题, 打开你项目的java build p ...
- 2012天津E题
给我们n个坐标点和一个距离d,表示车开m米就没油了. 然后要选几个点建立油站,使得能够从1出发遍历所有的点,然后回到1. 并且规定1这个点必须有油站,在第i个点建立油站的费用是 2^(i-1) 因为 ...
- vs2012 它已停止工作 - 解决方案
最近学习<Windows多媒体编程>本课程, 蛋疼, 学校原来是MFC... 然后安装vs2012. 后来又在几个插件.. 在这个问题. 开业,提示 vs2012 它已停止工作. wa ...
- POJ1300(欧拉回路)
Door Man Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 2139 Accepted: 858 Descripti ...
- 设计模式 - 模板方法模式(template method pattern) JFrame 具体解释
模板方法模式(template method pattern) JFrame 具体解释 本文地址: http://blog.csdn.net/caroline_wendy 參考模板方法模式(templ ...
- DevExpress控件使用之RichEditControl的使用
原文:DevExpress控件使用之RichEditControl的使用 做Winform的,我们一般都知道,传统.NET界面有一个RichTextBox控件,这个是一个富文本控件,可以存储图片文字等 ...
- 移植kl档,但调用默认Generic.kl解决的方法
从飞机到现在移植模型来开发遥控器按键,调查发现,大部分的功能键始终没有任何效果. 跑 dumpsys input 要查看当前的关键kl, 查找KeyLayoutFile它原来是默认Generic.kl ...