摘要:
题目:http://codeforces.com/contest/260/problem/A思路:a%b==0 => a*10^n%b==0这题一开始忽略了一句话If there are multiple possible answers, print any of them.想了半天觉得答案不只一种啊然后看到n的范围就知道这题不可能一位位算#include <iostream>#include <cstdlib>using namespace std;int a,b,n;int main(){ cin >> a>>b>>n; 阅读全文
摘要:
题目:http://codeforces.com/contest/257/problem/A给出接线板 用电器 原有插座的数量;给出每个接线板的插座个数;求最少需要多少插线板;思路:贪心法#include <iostream>#include <cstdlib>using namespace std;int n,m,k;int arr[55];int cmp(const void *a,const void *b){ return *((int *)b)-*((int *)a);}int main(){ cin >> n >> m >> 阅读全文
摘要:
题目:http://codeforces.com/contest/262/problem/A#include <iostream>#include <stdio.h>#include <string.h>using namespace std;int main(){ int n,k; cin >> n >> k; int num; int ans=0; char digit[10]; for(int i=0;i<n;i++) { int counter=0; cin >> num; int flag=1; ... 阅读全文
摘要:
题目:http://poj.org/problem?id=3030思路:模拟题#include <iostream>using namespace std;int main(){ int n; cin >> n; int r,e,c; for(int i=0;i<n;i++) { cin >> r >> e >> c; if(r<e-c) cout << "advertise" <<endl; else if(r==e-c) cout << "does no 阅读全文
摘要:
题目:http://hustoj.sinaapp.com/problem.php?id=1843这题我做了有五个小时...就是没读懂题目中 "从每一个数字开始数一次" 是什么意思...思路:既然是循环我就构建了个循环链表,然后从M往上一个个枚举。#include <iostream>#include <cmath>#include <stdio.h>using namespace std;int digit[10];int num;struct nodes{ int n; nodes *next;}node[10];void create 阅读全文