`
文章列表

ACM 3n+1的问题

    博客分类:
  • ACM
Problem Description Problems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will be analyzing a property of an algorithm whose classification is not known for all possible inputs. Consider the following algo ...

ACM大数的阶乘问题

    博客分类:
  • ACM
题目的大概意思是求数阶乘的位数: Problem Description In many applications very large integers numbers are required. Some of these applications are using keys for secure transmission of data, encryption, etc. In this problem you are given a number, you have to determine the number of digits in the factorial of the nu ...
任务一:第一个texture程序 我有一点始终搞不明白,编程大牛们为什么总喜欢把简单的事情都说的那么含蓄,让读者看了总是心虚。我也一样,看了很多大牛们对CUDA中texture的讲解,我稀里糊涂的,心里没底,今天我终于发现了一个能让我马上能接受的讲解,所以很有必要做个笔录。 什么是texture,其实就是GPU内存,它只可读,但是在性能上具有很多优势(我现在也没搞明白在哪,一会再去查查),怎么用呢?首先你的在cpu上定义一个texture的参考,也就是绑定到texture的代号(就像我们给陈水扁取名为“阿扁”一样);然后就是绑定texture参考到纹理(gpu内存),利用一些纹理获取函数取得纹理 ...

FatMouse's Trade

    博客分类:
  • ACM
学了一阵子的CUDA,突然有点感概,突然感觉C语言、计算机组成原理、编译原理、微机原理等课程是多么重要,大学浪费了。。现在绝大部分的并行程序设计都是基于C扩展的。谭浩强的那本C学得再久感觉还是没学透,所以今天又上杭电ACM做了一道题,就当复习C语言了。。整个程序编了20分钟,调了一个多小时,C指针真难!!! FatMouse' Trade Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6744    Accepted Submiss ...

Number Sequence

    博客分类:
  • ACM
A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n). Input The input consists of multiple test cases. Each test case contains 3 integers A, B and n on a single line (1 <= A, B <= ...
Sample Input 5 green red blue red red 3 pink orange pink 0 Sample Output red pink code as following #include <iostream> #include <map> #include <string> using namespace std; int main() {       int  nCount;       while(cin>>nCount && nCount)       {           string ...
问题描述:给定n种物品和一个背包,物品I的重量是Wi,其价值为Vi,背包的容量为c,问如何选择装入 背包的物品,使得装入背包的物品的总价值最大? 形式化描述:给定c求一个n元1-0向量Xi(每种物品要么装要么不装)             Wi Xi(i从1到n连乘累加,Xi=0或1)〈=c             Vi Xi(i从1到n连乘累加,Xi=0或1) 达到最大 /*f(j,x)是当背包载重为x,可供选择的物品为0,1...j时的最优解*/ /*最优解的递归式:*/ /* f(-1,x)=-9999(负无穷大) x<0 */ /* f(-1,x)=0 x>=0 * ...
Global site tag (gtag.js) - Google Analytics