Fancy Mouse
- -|||
上一页 1 ··· 4 5 6 7 8 9 下一页
摘要: 列一个关于行和列的通式吧第n行第m列一定是f(n,m)这个数……然后把函数一般式求出来就ok了 #includeusing namespace std;int main(){ int t,line,row; while(cin>>t) { for(line=0;line<t;line++) { cout<<line*(line+1... 阅读全文
posted @ 2005-08-21 17:45 Fancy Mouse 阅读(350) 评论(1) 推荐(0)
摘要: 杨辉三角~~画一个矩阵然后按照定义算吧 #includeusing namespace std;#define N 34void Triangle(int Num);int main(){ int n,datas=1; while(cin>>n) { if(datas>1) cout0 && Line==Row) cout<<' '; ... 阅读全文
posted @ 2005-08-21 17:43 Fancy Mouse 阅读(501) 评论(2) 推荐(0)
摘要: 没意思的题……讲编程语言的书都有说明的 #includeusing namespace std;int main(){ int sum=0,a; while(cin>>a) sum+=a; cout<<sum<<endl; return 0;} 阅读全文
posted @ 2005-08-21 17:41 Fancy Mouse 阅读(350) 评论(1) 推荐(0)
摘要: 直接用定义去做吧,不会tle的 #includeusing namespace std;int IsSevens(int Number);int main(){ int Max,c; cin>>Max; for(c=7;c0) { if(Number % 10 == 7) return 1; else Number/=10; } re... 阅读全文
posted @ 2005-08-21 17:40 Fancy Mouse 阅读(461) 评论(1) 推荐(0)
摘要: 类似Fibonacci数列,记得这种题用递归做你就死翘翘了(复杂度O(2^N))。好歹也应该设一个数组再递推的(复杂度O(N))关于Fibonacci数列,TJU1248的难度……偶现在还是tle……努力思索中,哈哈~~帖1005的代码: #includeusing namespace std;int Cows(int Years);int main(){ int yrs,cow; w... 阅读全文
posted @ 2005-08-21 12:12 Fancy Mouse 阅读(662) 评论(4) 推荐(0)
摘要: 呵呵~~经典动态规划题。当然,这题的数据规模不大,所以就算搜索也不会tle。当然,最好的办法还是动规。这里我用的是搜索+剪枝的办法。仔细分析一下题目,求一套导弹系统能击落多少导弹就是问你这个数列中最长的不下降(降序)子序列。求要多少导弹系统才能击落所有导弹就是问你这个数列中最长的上升(升序)子序列。第二点我说明一下,一个数列必定存在升序子序列,这个序列里面的任何两个数(两颗导弹)不能被分在一起(被... 阅读全文
posted @ 2005-08-21 12:10 Fancy Mouse 阅读(788) 评论(1) 推荐(0)
摘要: 也米有什么好说的了,直接做就行了 #includeusing namespace std;int main(){ int N,temp,temp2; cin>>N; char s='A'; for(temp=0;temp0;temp2--) cout0;temp2--) cout<<s; cout<<endl; s++; } retu... 阅读全文
posted @ 2005-08-21 12:03 Fancy Mouse 阅读(379) 评论(1) 推荐(0)
摘要: 经典的递归题。一层递归确定一个字母,第一层确定第一个字母。而确定字母是通过字符交换来实现排列的~~说的晦涩了一些,看代码吧: #includeusing namespace std;void Permulate(char s[],int start,int all);void Copy(char a[],char b[],int i);int main(){ char s[10]; c... 阅读全文
posted @ 2005-08-21 12:02 Fancy Mouse 阅读(745) 评论(2) 推荐(0)
摘要: 第一个正式题。注意它的样例输出,Y和U是在第三列上,因此他们前面都要打两个space而不是一个。 代码如下: #includeusing namespace std;int abs(int Number);int main(){ int Lines,count1,count2; char c='Z'; cin>>Lines; for(count1=Lines-1;abs(c... 阅读全文
posted @ 2005-08-21 12:00 Fancy Mouse 阅读(729) 评论(4) 推荐(0)
摘要: http://acm.tongji.edu.cn/showproblem.php?problem_id=1000 这个……呃……TOJ上面没给出C++的代码,偶就用C++写一个(别说我无聊哈) #includeusing namespace std;int main(){ int a,b; cin>>a>>b; cout<<a+b<<endl; return 0;} 阅读全文
posted @ 2005-08-21 11:55 Fancy Mouse 阅读(586) 评论(1) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 下一页