摘要:
这个题目直接用的暴力枚举,但是还是WA了几次原因是这句话You should process all pairs of integers and for each pair determine the maximum cycle length over all integers between and including i and j.注意i可能大于j,此时需要交换顺序,但是输出的时候还会是原始顺序比如 输入1 10 输出 1 10 20 ;输入10 1 输出 10 1 20因此交换i和j需要用标志位记录一下Source CodeProblem: 1207User: yangliuACMer 阅读全文
摘要:
水题一道,以后还是不做水题,没什么收获Source CodeProblem: 2017User: yangliuACMerMemory: 244KTime: 0MSLanguage: C++Result: Accepted#include <iostream>using namespace std;int main(){ int n,s[11],t[11]; int i,ret; while(cin>>n, n != -1){ ret = 0; memset(s, 0, sizeof(s)); memset(t, 0, sizeof(t)); for(i = 1; i 阅读全文