随笔分类 -  保存代码

纯粹是存代码
摘要:转onehot one_hot = F.one_hot(label.long(), num_classes=n_classes) 转回来 label = torch.argmax(one_hot, -1) 阅读全文
posted @ 2021-01-12 10:20 mrbean 阅读(896) 评论(0) 推荐(0)
摘要:Took 0.152364 seconds Took 0.061580 seconds Took 1.016529 seconds Took 0.215403 seconds 阅读全文
posted @ 2018-12-12 09:37 mrbean 阅读(3581) 评论(0) 推荐(0)
摘要:#题目描述:##Excel Sheet Column TitleGiven a positive integer, return its corresponding column title as appear in an Excel sheet.For example: 1 -> A ... 阅读全文
posted @ 2014-12-30 00:38 mrbean 阅读(1438) 评论(0) 推荐(0)
摘要:#题目概要:Given a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.For example,Given the following matrix: ... 阅读全文
posted @ 2014-12-29 23:54 mrbean 阅读(187) 评论(0) 推荐(0)
摘要:题目描述: Given a collection of numbers, return all possible permutations. For example, have the following permutations: , and . 解题思路: 这道题目由于是求所有的全排列,比较直观 阅读全文
posted @ 2014-12-22 17:10 mrbean 阅读(225) 评论(0) 推荐(0)
摘要:#题目描述:Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted... 阅读全文
posted @ 2014-12-20 01:01 mrbean 阅读(281) 评论(0) 推荐(0)
摘要:题目描述:一个N*M的矩阵,找出这个矩阵中所有元素的和不小于K的面积最小的子矩阵(矩阵中元素个数为矩阵面积)输入:每个案例第一行三个正整数N,M 5 #include 6 #include 7 using namespace std; 8 int main() 9 {10 //freopen... 阅读全文
posted @ 2014-06-29 14:34 mrbean 阅读(2390) 评论(0) 推荐(1)
摘要:题目描述:给定n,a求最大的k,使n!可以被a^k整除但不能被a^(k+1)整除。输入:两个整数n(2 2 #include 3 #include 4 using namespace std; 5 int su[168] = {2,3,5,7,11,13,17,19,23,29,31,37,41,4... 阅读全文
posted @ 2014-06-27 21:02 mrbean 阅读(2601) 评论(0) 推荐(0)
摘要:1 /*桌上放着排成一排的若干硬币。我们用 * 表示正面,用 o 表示反面(是小写字母,不是零)。 2 比如,可能情形是:**oo***oooo如果同时翻转左边的两个硬币,则变为:oooo***oooo 3 现在小明的问题是:如果已知了初始状态和要达到的目标状态,每次只能同时翻转相邻的两个硬币, 4 那么对特定的局面,最少要翻动多少次呢?我们约定:把翻动相邻的两个硬币叫做一步操作*/ 5 /* 6 思路简述:这是一个贪心题,不难想到,因为能够移动的只有相邻的两个硬币,所以不管两个硬币 7 在什么位置你都必须要将他们之间的一对一对移过去(因为移了一次必然是影响两个),所以最优的 8 做法也就是. 阅读全文
posted @ 2014-03-19 21:45 mrbean 阅读(947) 评论(0) 推荐(1)
摘要:Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 58189Accepted Submission(s): 15801Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, 阅读全文
posted @ 2013-12-05 17:03 mrbean 阅读(190) 评论(0) 推荐(0)