A. Alice的车牌号

Size: px
Start display at page:

Download "A. Alice的车牌号"

Transcription

1 Solution A. Alice 的车牌号 字符串匹配, 只要在所给字符串中查找是否出现 "13" 这个子串即可, 关键代码如下 bool judge(char str[]) return strstr(str, "13") == NULL; Code: #include <cstdio> #include <cstring> #include <cstdlib> #include <iostream> using namespace std; #define ONLINE_JUDGE const int MAX_LENGTH = 16; void solve() int test; int cas = 1; char str[max_length]; for (cin >> test; test--; ++cas) cin >> str; cout << "Case #" << cas << ": "; if (NULL == strstr(str, "13")) cout << "Yes, I like it!" << endl; else cout << "No, it's terrible!" << endl; return ; int main(int argc, char *argv[]) #ifndef ONLINE_JUDGE freopen("a.in", "r", stdin); freopen("a.out", "w", stdout); #endif solve(); return EXIT_SUCCESS;

2 B. Bella 的冒险之旅 Solution 图论, 树的最小表示, 解法是先用二进制数枚举所有可能的联通子树, 然后判断是否为联通子树, 然后枚举该联通子树中的每个点, 开始从该点开始进行 dfs 搜索, 在 dfs 过程中, 设置一个字符串记录 dfs 的路径, 方法是, 入点将路径字符串 +"0", 出点将路径字符串 +"1", 同时对于每次搜索到的节点, 对其后续搜索到的节点的路径进行排序, 之后再合并入该点的路径, 当搜索完整个连通子图后, 用 Trie 对路径字符串判重 最后统计即可 Code: #include <iostream> #include <functional> #include <algorithm> #include <complex> #include <cstdlib> #include <cstring> #include <fstream> #include <iomanip> #include <sstream> #include <utility> #include <bitset> #include <cctype> #include <cstdio> #include <limits> #include <memory> #include <string> #include <vector> #include <cmath> #include <ctime> #include <queue> #include <stack> #include <list> #include <map> #include <set> using namespace std; #define LOWBIT(x) ( (x) & ( (x) ^ ( (x) - 1 ) ) ) #define CLR(x, k) memset((x), (k), sizeof(x)) #define CPY(t, s) memcpy((t), (s), sizeof(s)) #define SC(t, s) static_cast<t>(s) #define LEN(s) static_cast<int>( strlen((s)) ) #define SZ(s) static_cast<int>( (s).size() ) typedef double LF; typedef int64 LL; //VC typedef unsigned int64 ULL; typedef pair<int, int> PII; typedef pair<ll, LL> PLL; typedef pair<double, double> PDD;

3 typedef vector<int> VI; typedef vector<char> VC; typedef vector<double> VF; typedef vector<string> VS; template <typename T> T sqa(const T & x) return x * x; template <typename T> T ll(const T & x) return x << 1; template <typename T> T rr(const T & x) return x << 1 1; template <typename T> T gcd(t a, T b) if (!a!b) return max(a, b); T t; while (t = a % b) a = b; b = t; return b; ; const int INF_INT = 0x3f3f3f3f; const LL INF_LL = 0x7fffffffffffffffLL; const double oo = 10e9; const double eps = 10e-7; const double PI = acos(-1.0); //15f #define ONLINE_JUDGE const int MAXV = 10004; const int MAXN = ; int test, n; struct Node Node * next[2]; bool end_sign; trie[maxn], * const root = trie; int ncnt; VI G[MAXV]; bool hs[maxv]; void inittrie()

4 ncnt = 1; for (int i = 0; i < 2; ++i) root->next[i] = NULL; root->end_sign = false; return ; Node * createnode() for (int i = 0; i < 2; ++i) trie[ncnt].next[i] = NULL; trie[ncnt].end_sign = false; return &trie[ncnt++]; bool inserttrie(const string & str) Node * ptr = root; int len = SC(int, str.length()); for (int i = 0; i < len; ++i) int t = str[i] - '0'; if (NULL == ptr->next[t]) ptr->next[t] = createnode(); ptr = ptr->next[t]; if (ptr->end_sign) return false; ptr->end_sign = true; return true; void addedge(int u, int v) G[u].push_back(v); return ; void search(int u, int state) hs[u] = true; for (VI::iterator it = G[u].begin(); it!= G[u].end(); ++it) int v = *it;

5 if ((1 << v) & state) if (!hs[v]) search(v, state); return ; bool connectedjudge(int state) CLR(hs, false); for (int i = 0; i < n; ++i) if ((1 << i) & state) search(i, state); break ; for (int i = 0; i < n; ++i) if ((1 << i) & state) if (!hs[i]) return false; return true; string dfs(int u, string str, int state) VS vs; hs[u] = true; for (VI::iterator it = G[u].begin(); it!= G[u].end(); ++it) int v = *it; if ((1 << v) & state) if (!hs[v]) vs.push_back(dfs(v, "0", state) + "1"); sort(vs.begin(), vs.end());

6 for (VS::iterator it = vs.begin(); it!= vs.end(); ++it) str += *it; return str; bool insertjudge(int state) bool sign = false; for (int u = 0; u < n; ++u) if ((1 << u) & state) CLR(hs, false); if (inserttrie(dfs(u, "", state))) sign = true; return sign; void ace() int cas = 1; int u, v; int res; for (scanf("%d", &test); test--; ++cas) scanf("%d", &n); for (int i = 0; i < n; ++i) G[i].clear(); inittrie(); for (int i = 0; i < n - 1; ++i) scanf("%d %d", &u, &v); addedge(u, v); addedge(v, u); res = 0; for (int state = 1; state < (1 << n); ++state) if (!connectedjudge(state)) continue ; if (insertjudge(state))

7 ++res; printf("case #%d: %d\n", cas, res); return ; int main() #ifndef ONLINE_JUDGE freopen("in.txt", "r", stdin); freopen("out.txt", "w", stdout); #endif ace(); return 0;

8 Solution C. Catherine 的魔法符文 杂题, 注意控制输出即可, 不要在输出图案后面输出空格 Code: #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; #define ONLINE_JUDGE void solve() int test, n; int cas = 1; for (cin >> test; test--; ++cas) cin >> n; cout << "Case #" << cas << ": " << endl; if (1 == n) cout << "1" << endl << endl; continue ; for (int i = 1; i <= n; ++i) for (int j = 0; j < 2 * (n - i); ++j) cout << " "; cout << "1"; for (int j = 2; j <= i; ++j) cout << " " << j; for (int j = i - 1; j >= 1; --j) cout << " " << j; cout << endl; for (int i = n - 1; i >= 1; --i) for (int j = 0; j < 2 * (n - i); ++j) cout << " "; cout << "1"; for (int j = 2; j <= i; ++j)

9 cout << " " << j; for (int j = i - 1; j >= 1; --j) cout << " " << j; cout << endl; cout << endl; return ; int main(int argc, char *argv[]) #ifndef ONLINE_JUDGE freopen("c.in", "r", stdin); freopen("c.out", "w", stdout); #endif solve(); return EXIT_SUCCESS;

10 Solution D. Diana 的组队烦恼 组合数学 + 动态规划, 注意当 k>n 时, 没有对应的分组策略, 应输出 0,k=1 或者 k=n 时, 分组方案只有 1 种, 否 则,n 个人分成 k 个小组, 都可以看成是原先 n-1 个人分成 k 个小组, 再将 1 个人插入原先的 k 个小组, 以及原先 n-1 个人分成 k-1 个小组, 再让 1 个人独立组成一个小组, 所以有状态转移方程 dp[n][k] = dp[n - 1][k - 1] + k * dp[n - 1][k]; Code: #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; #define ONLINE_JUDGE typedef long long LL; const int MAX_SIZE = 20; void solve() int test, n, k; LL dp[max_size][max_size]; int cas = 1; for (int i = 0; i < MAX_SIZE; ++i) dp[i][1] = 1; dp[i][i] = 1; for (int i = 3; i < MAX_SIZE; ++i) for (int j = 2; j < i; ++j) dp[i][j] = j * dp[i - 1][j] + dp[i - 1][j - 1]; for (cin >> test; test--; ++cas) cin >> n >> k; cout << "Case #" << cas << ": "; if (k > n) cout << 0 << endl; else cout << dp[n][k] << endl;

11 return ; int main(int argc, char *argv[]) #ifndef ONLINE_JUDGE freopen("d.in", "r", stdin); freopen("d.out", "w", stdout); #endif solve(); return EXIT_SUCCESS;

12 Solution E. 最低等级 可以用将 n 转换为二进制数后再找最低比特位, 更好的方法是直接用位运算, int lowbit(const int &x) return x & (-x); Code: #include <cstdio> #include <cstdlib> #include <iostream> using namespace std; #define ONLINE_JUDGE void solve() int test; int cas = 1; int n; for (cin >> test; test--; ++cas) cin >> n; cout << "Case #" << cas << ": " << ((n) & (-n)) << endl; return ; int main(int argc, char *argv[]) #ifndef ONLINE_JUDGE freopen("e.in", "r", stdin); freopen("e.out", "w", stdout); #endif solve(); return EXIT_SUCCESS;

13 F. 寻找砝码集 Solution 数论, 可以证明可以组成砝码集的物品的最大公约数和所有物品的最大公约数相等 所以本题即求对每个物品除以所有物品最大公约数后, 最大公约数为 1 的物品集合 由于所有物品重量都小于 , 所有可能的物品集合的最大公约数都不超过 , 又因为 n 很小, 所以可以开一个容量为 的整形数组 d 记录每个可能的最大公约数最少由多少个物品构成, 然后借助队列, 逐步枚举由 1 个物品 2 个物品直到 n 个物品构成的所有最大公约数即可,d[1] 的值就是所求数量 Code: #include <iostream> #include <cstdlib> #include <cstdio> #include <memory> #include <cstring> #include <cmath> #include <ctime> #include <algorithm> #include <set> #include <vector> #include <set> #include <map> #include <queue> #include <stack> using namespace std; int gcd(int a, int b) int t; while(b!= 0) t = b; b = a % b; a = t; return a; int d[ ]; class BalanceScale public: int takeweights(vector <int> w) int i, tmp; int n = w.size(); tmp = w[0]; for(i = 1; i < n; ++i) tmp = gcd(tmp, w[i]); for(i = 0; i < n; ++i)

14 w[i] /= tmp; sort(w.begin(), w.end()); if(w[0] == 1) return 1; memset(d, 1, sizeof(d)); queue<int> q; for(i = 0; i < n; ++i) q.push(w[i]); d[w[i]] = 1; while(!q.empty() && d[1] == 0x ) int top = q.front(); q.pop(); for(i = 0; i < n; ++i) tmp = gcd(top, w[i]); if(d[tmp] == 0x ) d[tmp] = d[top] + 1; q.push(tmp); return d[1]; ; int main() int n; vector<int> w; BalanceScale solution; while (cin >> n, n) w.clear(); int data; for (int i = 0; i < n; ++i) cin >> data; w.push_back(data); cout << solution.takeweights(w) << endl; return 0;

15 Solution G. 奇怪的电梯 图论, 以楼层为节点, 如果一个楼层可达另一个楼层则添加一条有向边, 建图后用任意一个最短路径算法求解 Code: #include <iostream> #include <cstdlib> #include <cstdio> #include <memory.h> #include <cstring> #include <algorithm> #include <cmath> #include <set> #include <vector> #include <set> #include <map> #include <queue> #include <stack> using namespace std; #define ONLINE_JUDGE const int inf = 0x7fffffff; struct Edge int from, to, nxt; e[505]; int idx, n, a, b, d[205], head[205]; void addedge(int from, int to) e[idx].from = from; e[idx].to = to; e[idx].nxt = head[from]; head[from] = idx++; void Bellman_Ford() int i, j; for(i = 1; i <= n; ++i) d[i] = inf; d[a] = 0; for(i = 1; i <= n - 1; ++i)

16 for(j = 0; j < idx; ++j) if(d[e[j].from]!= inf) if(d[e[j].to] > d[e[j].from] + 1) d[e[j].to] = d[e[j].from] + 1; if(d[b] == inf) printf("-1\n"); else printf("%d\n", d[b]); int main() #ifndef ONLINE_JUDGE freopen("g.in", "r", stdin); freopen("g.out", "w", stdout); #endif int i, tmp; while(scanf("%d", &n)!= EOF) if(!n) break; scanf("%d%d", &a, &b); idx = 0; memset(head, -1, sizeof(head)); for(i = 1; i <= n; ++i) scanf("%d", &tmp); if(i - tmp > 0) addedge(i, i - tmp); if(i + tmp <= n) addedge(i, i + tmp); Bellman_Ford(); return 0;

17 Solution H. 宝盒密码 若存在这样的 x, 则其必然是 a 的约数, 因而可以枚举 a 的约数找出满足条件的最小的 x, 时间复杂度 O(sqrt(a)) Code: #include <stdio.h> #include <time.h> int main( int argc, char *argv[] ) //clock_t t1 = clock(); //freopen( "a.in", "r", stdin ); //freopen( "a.out", "w", stdout ); int x, d, l, h, a, b, cas = 0, t, r; scanf( "%d", &t ); while ( t-- ) scanf( "%d%d%d%d", &l, &h, &a, &b ); r = -1; if ( ( a % b ) == 0 && a >= l && a <= h ) r = a; for ( x = 1; x * x <= a && x <= h; ++x ) if ( a % x ) continue; if ( ( x % b ) == 0 ) if ( x >= l && x <= h ) d = a / x; r = x; break; if ( ( d % b ) == 0 ) if ( d >= l && d <= h ) r = d; printf( "Case #%d: %d\n", ++cas, r ); //clock_t t2 = clock(); //printf( "%.3f ms\n", ( t2 - t1 ) * 1.0 / CLOCKS_PER_SEC * ); return 0;

18 Solution I. 法默尔的农场 用线段树, 按水位的不断增高查询线段树, 一边查询一边更新线段树, 线段树节点 : struct Node ; int lm, cm, rm; Node() Node( int l, int c, int r ):lm(l), cm(c), rm(r) struct TREE ; int min, max; Node node; max 表示当前区间最高的山丘高度, min 表示当前区间最低的尚没有被水淹没的山丘高度 lm 表示本区间的左端山丘是否被水淹没, rm 表示本区间的右端山丘是否被水淹没, cm 表示本区间有多少小岛 更新的时候, 除 max 域外, 其它四个域都要更新 核心思想是当水位小于 min 或大于 max 时, 则不需要分解此区间 Code: 离线 : #include <stdio.h> #include <algorithm> #include <time.h> using namespace std; struct Node ; int lm, cm, rm; Node() Node( int l, int c, int r ):lm(l), cm(c), rm(r) struct TREE ; int l, r, min, max; Node node; struct Num ; int q, id; TREE tree[400006]; int h[100005], n, re[100005]; Num num[100005]; bool cmp( const Num &a, const Num &b ) return a.q < b.q; inline int _min( int a, int b ) if ( a > b ) return b; return a;

19 inline int _max( int a, int b ) if ( a > b ) return a; return b; void build( int l, int r, int id ) tree[id].l = l; tree[id].r = r; tree[id].node.cm = 1; tree[id].node.lm = 1; tree[id].node.rm = 1; int mid = ( l + r ) >> 1; if ( mid == l ) tree[id].min = h[l]; tree[id].max = h[l]; return; build( l, mid, id << 1 ); build( mid, r, (id<<1)^1 ); tree[id].max = _max( tree[id<<1].max, tree[(id<<1)^1].max ); tree[id].min = _min( tree[id<<1].min, tree[(id<<1)^1].min ); return; inline Node up( const Node &a, const Node &b ) return Node( a.lm, a.cm + b.cm - ( a.rm & b.lm ), b.rm ); const Node& query( int h, int id ) if ( h < tree[id].min ) return tree[id].node; if ( h >= tree[id].max ) tree[id].min = h + 1; tree[id].node.cm = 0; tree[id].node.lm = 0; tree[id].node.rm = 0; return tree[id].node; tree[id].node = up( query( h, id << 1 ), query( h, (id<<1)^1 ) ); if ( tree[id<<1].min > tree[id<<1].max ) tree[id].min = tree[(id<<1)^1].min; else if ( tree[(id<<1)^1].min > tree[(id<<1)^1].max ) tree[id].min = tree[id<<1].min; else tree[id].min = _min( tree[id<<1].min, tree[(id<<1)^1].min ); return tree[id].node;

20 int main( int argc, char *argv[] ) //clock_t t1 = clock(); //freopen( "b.in", "r", stdin ); //freopen( "b_off.out", "w", stdout ); int i, q; scanf( "%d", &n ); for ( i = 0; i < n; ++i ) scanf( "%d", h + i ); build( 0, n, 1 ); scanf( "%d", &q ); for ( i = 0; i < q; ++i ) scanf( "%d", &num[i].q ); num[i].id = i; sort( num, num + q, cmp ); for ( i = 0; i < q; ++i ) re[num[i].id] = query( num[i].q, 1 ).cm; for ( i = 0; i < q; ++i ) printf( "%d\n", re[i] ); //clock_t t2 = clock(); //printf( "%.3f ms\n", ( t2 - t1 ) * 1.0 / CLOCKS_PER_SEC * ); return 0; 在线 : #include <stdio.h> #include <algorithm> #include <time.h> using namespace std; struct Node ; int lm, cm, rm; Node() Node( int l, int c, int r ):lm(l), cm(c), rm(r) struct TREE ; int l, r, min, max; Node node; TREE tree[400006]; int h[100005], n, re[100005]; inline int _min( int a, int b ) if ( a > b ) return b; return a; inline int _max( int a, int b ) if ( a > b ) return a; return b;

21 void build( int l, int r, int id ) tree[id].l = l; tree[id].r = r; tree[id].node.cm = 1; tree[id].node.lm = 1; tree[id].node.rm = 1; int mid = ( l + r ) >> 1; if ( mid == l ) tree[id].min = h[l]; tree[id].max = h[l]; return; build( l, mid, id << 1 ); build( mid, r, (id<<1)^1 ); tree[id].max = _max( tree[id<<1].max, tree[(id<<1)^1].max ); tree[id].min = _min( tree[id<<1].min, tree[(id<<1)^1].min ); return; inline Node up( const Node &a, const Node &b ) return Node( a.lm, a.cm + b.cm - ( a.rm & b.lm ), b.rm ); const Node& query( int h, int id ) if ( h < tree[id].min ) return tree[id].node; if ( h >= tree[id].max ) tree[id].min = h + 1; tree[id].node.cm = 0; tree[id].node.lm = 0; tree[id].node.rm = 0; return tree[id].node; tree[id].node = up( query( h, id << 1 ), query( h, (id<<1)^1 ) ); if ( tree[id<<1].min > tree[id<<1].max ) tree[id].min = tree[(id<<1)^1].min; else if ( tree[(id<<1)^1].min > tree[(id<<1)^1].max ) tree[id].min = tree[id<<1].min; else tree[id].min = _min( tree[id<<1].min, tree[(id<<1)^1].min ); return tree[id].node; int bin_search( int l, int r, int x ) int mid; while ( l < r ) mid = ( l + r ) >> 1;

22 if ( h[mid] > x ) r = mid; else l = mid + 1; return re[l-1]; int main( int argc, char *argv[] ) //clock_t t1 = clock(); //freopen( "b.in", "r", stdin ); //freopen( "b_on.out", "w", stdout ); int i, q; scanf( "%d", &n ); h[0] = 0; for ( i = 1; i <= n; ++i ) scanf( "%d", h + i ); build( 1, n + 1, 1 ); sort( h + 1, h + n + 1 ); int j; for ( i = 2, j = 1; i <= n; ++i ) if ( h[i]!= h[j] ) ++j; if ( j!= i ) h[j] = h[i]; re[0] = 1; for ( i = 1; i <= j; ++i ) re[i] = query( h[i], 1 ).cm; scanf( "%d", &q ); int x; ++j; while ( q-- ) scanf( "%d", &x ); printf( "%d\n", bin_search( 0, j, x ) ); //clock_t t2 = clock(); //printf( "%.3f ms\n", ( t2 - t1 ) * 1.0 / CLOCKS_PER_SEC * ); return 0;

23 J. 银河系 5A 风景区 Solution 计算几何 + 随机算法, 模拟退火的经典应用, 根据空间中的四个点确定其球心, 时限很宽, 需要注意把握好火候, 火候太大会超时, 太小则达不到要求的精度 Code: #include <stdio.h> #include <stdlib.h> #include <time.h> #include <memory.h> #include <math.h> #include <sys/timeb.h> const double rate = 0.99; const double rad = ; const double eps = 0.01; const double nts = 30; const double pi2 = 2.0 * acos( -1.0 ); struct point double x, y, z; ; inline double dis( const point &a, const point &b ) return sqrt( (a.x-b.x) * (a.x-b.x) + (a.y-b.y) * (a.y-b.y) + (a.z-b.z) * (a.z-b.z) ); double buf[4]; double cal_dif( point p[], const point &tp ) int i; double sum = 0, x; for ( i = 0; i < 4; ++i ) buf[i] = dis( tp, p[i] ); sum += buf[i]; x = sum / 4.0; double re = 0; for ( i = 0; i < 4; ++i ) re += ( buf[i] - x ) * ( buf[i] - x ); return re; int main( int argc, char *argv[] ) //timeb t1; //ftime( &t1 ); //freopen( "c.out", "w", stdout ); //freopen( "c.in", "r", stdin ); srand( unsigned( time( NULL ) ) ); point p[4], o, to; double d, dif, td; int t, i, cas = 0;

24 scanf( "%d", &t ); while ( t-- ) for ( i= 0; i < 4; ++i ) scanf( "%lf%lf%lf", &p[i].x, &p[i].y, &p[i].z ); o.x = 0; o.y = 0; o.z = 0; for ( i = 0; i < 4; ++i ) o.x += p[i].x; o.y += p[i].y; o.z += p[i].z; o.x /= 4.0; o.y /= 4.0; o.z /= 4.0; dif = cal_dif( p, o ); d = rad; double a1, a2; while ( d > eps ) for ( i = 0; i < nts; ++i ) a1 = (double)( rand() ) * pi2 / ; a2 = (double)( rand() ) * pi2 / ; to.x = o.x + d * cos( a2 ) * cos( a1 ); to.y = o.y + d * cos( a2 ) * sin( a1 ); to.z = o.z + d * sin( a2 ); if ( fabs( to.x ) > 500 fabs( to.y ) > 500 fabs( to.z ) > 500 ) continue; td = cal_dif( p, to ); if ( td < dif ) dif = td; o = to; d *= rate; if ( fabs( o.x ) < 0.01 ) o.x = fabs( o.x ); if ( fabs( o.y ) < 0.01 ) o.y = fabs( o.y ); if ( fabs( o.z ) < 0.01 ) o.z = fabs( o.z ); printf( "Case #%d: ", ++cas ); printf( "%.1f %.1f %.1f\n", o.x, o.y, o.z ); //timeb t2; //ftime( &t2 ); //printf( "%d ms\n", t2.millitm - t1.millitm * ( t2.time - t1.time ) ); return 0;

新版 明解C++入門編

新版 明解C++入門編 511!... 43, 85!=... 42 "... 118 " "... 337 " "... 8, 290 #... 71 #... 413 #define... 128, 236, 413 #endif... 412 #ifndef... 412 #if... 412 #include... 6, 337 #undef... 413 %... 23, 27 %=... 97 &... 243,

More information

C/C++语言 - C/C++数据

C/C++语言 - C/C++数据 C/C++ C/C++ Table of contents 1. 2. 3. 4. char 5. 1 C = 5 (F 32). 9 F C 2 1 // fal2cel. c: Convert Fah temperature to Cel temperature 2 # include < stdio.h> 3 int main ( void ) 4 { 5 float fah, cel ;

More information

C 1

C 1 C homepage: xpzhangme 2018 5 30 C 1 C min(x, y) double C // min c # include # include double min ( double x, double y); int main ( int argc, char * argv []) { double x, y; if( argc!=

More information

2013 C 1 # include <stdio.h> 2 int main ( void ) 3 { 4 int cases, a, b, i; 5 scanf ("%d", & cases ); 6 for (i = 0;i < cases ;i ++) 7 { 8 scanf ("%d %d

2013 C 1 # include <stdio.h> 2 int main ( void ) 3 { 4 int cases, a, b, i; 5 scanf (%d, & cases ); 6 for (i = 0;i < cases ;i ++) 7 { 8 scanf (%d %d 2013 18 ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp, Compilation Error cin scanf Time Limit Exceeded 1: A 5 B 5 C 5 D 5 E 5 F 5 1 2013 C 1 # include 2 int main ( void ) 3 { 4 int cases, a, b,

More information

新・明解C言語入門編『索引』

新・明解C言語入門編『索引』 !... 75!=... 48 "... 234 " "... 9, 84, 240 #define... 118, 213 #include... 148 %... 23 %... 23, 24 %%... 23 %d... 4 %f... 29 %ld... 177 %lf... 31 %lu... 177 %o... 196 %p... 262 %s... 242, 244 %u... 177

More information

C 1 # include <stdio.h> 2 int main ( void ) { 4 int cases, i; 5 long long a, b; 6 scanf ("%d", & cases ); 7 for (i = 0;i < cases ;i ++) 8 { 9

C 1 # include <stdio.h> 2 int main ( void ) { 4 int cases, i; 5 long long a, b; 6 scanf (%d, & cases ); 7 for (i = 0;i < cases ;i ++) 8 { 9 201 201 21 ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp Compilation Error long long cin scanf Time Limit Exceeded 1: A 1 B 1 C 5 D RPG 10 E 10 F 1 G II 1 1 201 201 C 1 # include 2 int main ( void

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 49 [P.51] C/C++ [P.52] [P.53] [P.55] (int) [P.57] (float/double) [P.58] printf scanf [P.59] [P.61] ( / ) [P.62] (char) [P.65] : +-*/% [P.67] : = [P.68] : ,

More information

FY.DOC

FY.DOC 高 职 高 专 21 世 纪 规 划 教 材 C++ 程 序 设 计 邓 振 杰 主 编 贾 振 华 孟 庆 敏 副 主 编 人 民 邮 电 出 版 社 内 容 提 要 本 书 系 统 地 介 绍 C++ 语 言 的 基 本 概 念 基 本 语 法 和 编 程 方 法, 深 入 浅 出 地 讲 述 C++ 语 言 面 向 对 象 的 重 要 特 征 : 类 和 对 象 抽 象 封 装 继 承 等 主

More information

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023)

( CIP) /. :, ( ) ISBN TP CIP ( 2005) : : : : * : : 174 ( A ) : : ( 023) : ( 023) ( CIP) /. :, 2005. 2 ( ) ISBN 7-5624-3339-9.......... TP311. 1 CIP ( 2005) 011794 : : : : * : : 174 ( A ) :400030 : ( 023) 65102378 65105781 : ( 023) 65103686 65105565 : http: / /www. cqup. com. cn : fxk@cqup.

More information

2013 C 1 #include <stdio.h> 2 int main(void) 3 { 4 int cases, i; 5 long long a, b; 6 scanf("%d", &cases); 7 for (i = 0; i < cases; i++) 8 { 9 scanf("%

2013 C 1 #include <stdio.h> 2 int main(void) 3 { 4 int cases, i; 5 long long a, b; 6 scanf(%d, &cases); 7 for (i = 0; i < cases; i++) 8 { 9 scanf(% 2013 ( 28 ) ( ) 1. C pa.c, pb.c, 2. C++ pa.cpp, pb.cpp Compilation Error long long cin scanf Time Limit Exceeded 1: A 10 B 1 C 1 D 5 E 5 F 1 G II 5 H 30 1 2013 C 1 #include 2 int main(void) 3

More information

c_cpp

c_cpp C C++ C C++ C++ (object oriented) C C++.cpp C C++ C C++ : for (int i=0;i

More information

Microsoft Word - CPE考生使用手冊160524.docx

Microsoft Word - CPE考生使用手冊160524.docx 大 學 程 式 能 力 檢 定 (CPE) 考 生 使 用 手 冊 2016 年 5 月 24 日 這 份 手 冊 提 供 給 參 加 CPE 檢 定 考 試 的 考 生 內 容 包 含 考 試 環 境 的 使 用, 以 及 解 題 時 所 使 用 I/O 的 基 本 知 識 1. 如 欲 報 名 參 加 CPE 考 試, 請 先 於 CPE 網 站 完 成 帳 號 註 冊, 然 後 再 報 名 該

More information

第3章.doc

第3章.doc 3 3 3 3.1 3 IT Trend C++ Java SAP Advantech ERPCRM C++ C++ Synopsys C++ NEC C C++PHP C++Java C++Java VIA C++ 3COM C++ SPSS C++ Sybase C++LinuxUNIX Motorola C++ IBM C++Java Oracle Java HP C++ C++ Yahoo

More information

C/C++ 语言 - 循环

C/C++ 语言 - 循环 C/C++ Table of contents 7. 1. 2. while 3. 4. 5. for 6. 8. (do while) 9. 10. (nested loop) 11. 12. 13. 1 // summing.c: # include int main ( void ) { long num ; long sum = 0L; int status ; printf

More information

nooog

nooog C : : : , C C,,, C, C,, C ( ), ( ) C,,, ;,, ; C,,, ;, ;, ;, ;,,,, ;,,, ; : 1 9, 2 3, 4, 5, 6 10 11, 7 8, 12 13,,,,, 2008 1 1 (1 ) 1.1 (1 ) 1.1.1 ( ) 1.1.2 ( ) 1.1.3 ( ) 1.1.4 ( ) 1.1.5 ( ) 1.2 ( ) 1.2.1

More information

untitled

untitled A, 3+A printf( ABCDEF ) 3+ printf( ABCDEF ) 2.1 C++ main main main) * ( ) ( ) [ ].* ->* ()[] [][] ** *& char (f)(int); ( ) (f) (f) f (int) f int char f char f(int) (f) char (*f)(int); (*f) (int) (

More information

CC213

CC213 : (Ken-Yi Lee), E-mail: feis.tw@gmail.com 177 [P179] (1) - [P181] [P182] (2) - for [P183] (3) - switch [P184] [P187] [P189] [P194] 178 [ ]; : : int var; : int var[3]; var 2293620 var[0] var[1] 2293620

More information

untitled

untitled 1 Outline 數 料 數 數 列 亂數 練 數 數 數 來 數 數 來 數 料 利 料 來 數 A-Z a-z _ () 不 數 0-9 數 不 數 SCHOOL School school 數 讀 school_name schoolname 易 不 C# my name 7_eleven B&Q new C# (1) public protected private params override

More information

untitled

untitled 1 DBF (READDBF.C)... 1 2 (filetest.c)...2 3 (mousetes.c)...3 4 (painttes.c)...5 5 (dirtest.c)...9 6 (list.c)...9 1 dbf (readdbf.c) /* dbf */ #include int rf,k,reclen,addr,*p1; long brec,erec,i,j,recnum,*p2;

More information

_汪_文前新ok[3.1].doc

_汪_文前新ok[3.1].doc 普 通 高 校 本 科 计 算 机 专 业 特 色 教 材 精 选 四 川 大 学 计 算 机 学 院 国 家 示 范 性 软 件 学 院 精 品 课 程 基 金 青 年 基 金 资 助 项 目 C 语 言 程 序 设 计 (C99 版 ) 陈 良 银 游 洪 跃 李 旭 伟 主 编 李 志 蜀 唐 宁 九 李 涛 主 审 清 华 大 学 出 版 社 北 京 i 内 容 简 介 本 教 材 面 向

More information

ebook39-5

ebook39-5 5 3 last-in-first-out, LIFO 3-1 L i n e a r L i s t 3-8 C h a i n 3 3. 8. 3 C + + 5.1 [ ] s t a c k t o p b o t t o m 5-1a 5-1a E D 5-1b 5-1b E E 5-1a 5-1b 5-1c E t o p D t o p D C C B B B t o p A b o

More information

C

C C 2017 4 1 1. 2. while 3. 4. 5. for 6. 2/161 C 7. 8. (do while) 9. 10. (nested loop) 11. 12. 3/161 C 1. I 1 // summing.c: 2 #include 3 int main(void) 4 { 5 long num; 6 long sum = 0L; 7 int status;

More information

C++ 程序设计 OJ9 - 参考答案 MASTER 2019 年 6 月 7 日 1

C++ 程序设计 OJ9 - 参考答案 MASTER 2019 年 6 月 7 日 1 C++ 程序设计 OJ9 - 参考答案 MASTER 2019 年 6 月 7 日 1 1 CARDGAME 1 CardGame 题目描述 桌上有一叠牌, 从第一张牌 ( 即位于顶面的牌 ) 开始从上往下依次编号为 1~n 当至少还剩两张牌时进行以下操作 : 把第一张牌扔掉, 然后把新的第一张放到整叠牌的最后 请模拟这个过程, 依次输出每次扔掉的牌以及最后剩下的牌的编号 输入 输入正整数 n(n

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.06.doc 2 5 8 11 0 13 1. 13 2. 15 3. 18 1 23 1. 23 2. 26 3. 28 2 36 1. 36 2. 39 3. 42 4. 44 5. 49 6. 51 3 57 1. 57 2. 60 3. 64 4. 66 5. 70 6. 75 7. 83 8. 85 9. 88 10. 98 11. 103 12. 108 13. 112 4 115 1. 115 2.

More information

C/C++语言 - 分支结构

C/C++语言 - 分支结构 C/C++ Table of contents 1. if 2. if else 3. 4. 5. 6. continue break 7. switch 1 if if i // colddays.c: # include int main ( void ) { const int FREEZING = 0; float temperature ; int cold_ days

More information

[改訂新版]C言語による標準アルゴリズム事典

[改訂新版]C言語による標準アルゴリズム事典 iii C 1991 SEND + MORE = MONEY C 100 2003 Java 2003 27 PC-9800 C BMP SVG EPS BMPSVG WindowsMacLinux Web iv int main() int main(void) EXIT_SUCCESS 0 https://github.com/okumuralab/ algo-c TEX TEX PDF PDF

More information

chap07.key

chap07.key #include void two(); void three(); int main() printf("i'm in main.\n"); two(); return 0; void two() printf("i'm in two.\n"); three(); void three() printf("i'm in three.\n"); void, int 标识符逗号分隔,

More information

untitled

untitled 不 料 料 例 : ( 料 ) 串 度 8 年 數 串 度 4 串 度 數 數 9- ( ) 利 數 struct { ; ; 數 struct 數 ; 9-2 數 利 數 C struct 數 ; C++ 數 ; struct 省略 9-3 例 ( 料 例 ) struct people{ char name[]; int age; char address[4]; char phone[]; int

More information

Microsoft PowerPoint - 10 模板 Template.pptx

Microsoft PowerPoint - 10 模板 Template.pptx 模板 Tempalte 泛型编程的需要 Why Templates? 设想你对整数类型实现了一个排序算法 : void sort(int *is,int n); 用该函数可以对实 复数或工资单排序吗? 模板可以复用源代码 - 泛型编程. inline void Swap( int &x, int &y){ int t = x; x = y; y =t; inline void Swap(double

More information

untitled

untitled 1 1.1 1.2 1.3 1.4 1.5 ++ 1.6 ++ 2 BNF 3 4 5 6 7 8 1.2 9 1.2 IF ELSE 10 1.2 11 1.2 12 1.3 Ada, Modula-2 Simula Smalltalk-80 C++, Objected Pascal(Delphi), Java, C#, VB.NET C++: C OOPL Java: C++ OOPL C# C++

More information

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++;

int *p int a 0x00C7 0x00C7 0x00C int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; Memory & Pointer trio@seu.edu.cn 2.1 2.1.1 1 int *p int a 0x00C7 0x00C7 0x00C7 2.1.2 2 int I[2], *pi = &I[0]; pi++; char C[2], *pc = &C[0]; pc++; float F[2], *pf = &F[0]; pf++; 2.1.3 1. 2. 3. 3 int A,

More information

四川省普通高等学校

四川省普通高等学校 四 川 省 普 通 高 等 学 校 计 算 机 应 用 知 识 和 能 力 等 级 考 试 考 试 大 纲 (2013 年 试 行 版 ) 四 川 省 教 育 厅 计 算 机 等 级 考 试 中 心 2013 年 1 月 目 录 一 级 考 试 大 纲 1 二 级 考 试 大 纲 6 程 序 设 计 公 共 基 础 知 识 6 BASIC 语 言 程 序 设 计 (Visual Basic) 9

More information

Microsoft PowerPoint - ds-1.ppt [兼容模式]

Microsoft PowerPoint - ds-1.ppt [兼容模式] http://jwc..edu.cn/jxgl/ HomePage/Default.asp 2 说 明 总 学 时 : 72( 学 时 )= 56( 课 时 )+ 16( 实 验 ) 行 课 时 间 : 第 1 ~14 周 周 学 时 : 平 均 每 周 4 学 时 上 机 安 排 待 定 考 试 时 间 : 课 程 束 第 8 11 12 章 的 内 容 为 自 学 内 容 ; 目 录 中 标 有

More information

内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2

内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2 第 六 讲 指 针 与 字 符 串 1 内 容 提 要 指 针 持 久 动 态 内 存 分 配 字 符 串 ( 字 符 数 组 ) 2 指 针 什 么 是 指 针 指 针 的 定 义 与 运 算 指 针 与 一 维 数 组 指 针 数 组 行 指 针 与 二 维 数 组 指 针 与 引 用 指 针 与 函 数 3 指 针 定 义 什 么 是 指 针 指 针 变 量, 简 称 指 针, 用 来 存 放

More information

untitled

untitled 3 C++ 3.1 3.2 3.3 3.4 new delete 3.5 this 3.6 3.7 3.1 3.1 class struct union struct union C class C++ C++ 3.1 3.1 #include struct STRING { typedef char *CHARPTR; // CHARPTR s; // int strlen(

More information

untitled

untitled Introduction to Programming ( 數 ) Lecture 3 Spring 2005 March 4, 2005 Lecture 2 Outline 數 料 If if 狀 if 2 (Standard Output, stdout): 料. ((Standard Input, stdin): 料. 類 數 數 數 說 printf 見 數 puts 串 數 putchar

More information

华恒家庭网关方案

华恒家庭网关方案 LINUX V1.5 1 2 1 2 LINUX WINDOWS PC VC LINUX WINDOWS LINUX 90% GUI LINUX C 3 REDHAT 9 LINUX PC TFTP/NFS http://www.hhcn.com/chinese/embedlinux-res.html minicom NFS mount C HHARM9-EDU 1 LINUX HHARM9-EDU

More information

迅速在两个含有大量数据的文件中寻找相同的数据

迅速在两个含有大量数据的文件中寻找相同的数据 迅速在两个含有大量数据的文件中寻找相同的数据 求解问题如下 : 在本地磁盘里面有 file1 和 file2 两个文件, 每一个文件包含 500 万条随机整数 ( 可以重复 ), 最大不超过 2147483648 也就是一个 int 表示范围 要求写程序将两个文件中都含有的整数输出到一个新文件中 要求 : 1. 程序的运行时间不超过 5 秒钟 2. 没有内存泄漏 3. 代码规范, 能要考虑到出错情况

More information

C++11概要 ライブラリ編

C++11概要 ライブラリ編 C++11 Egtra 2012 6 23 1 Boost. #9 1.1 C++11 1.2 http://creativecommons.org/licenses/by-sa/2.1/jp/ - 2.1 2 Misc 2.1 C++11 unique_ptr shared_ptr // #include std::unique_ptr up(new int(1));

More information

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit

6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C C C51 C51 ANSI C MCS-51 C51 ANSI C C C51 bit Byte bit sbit 6 C51 ANSI C Turbo C C51 Turbo C C51 C51 C51 C51 C51 C51 C51 C51 C51 6.1 C51 6.1.1 C51 C51 ANSI C MCS-51 C51 ANSI C C51 6.1 6.1 C51 bit Byte bit sbit 1 0 1 unsigned char 8 1 0 255 Signed char 8 11 128

More information

C++ 程式設計

C++ 程式設計 C C 料, 數, - 列 串 理 列 main 數串列 什 pointer) 數, 數, 數 數 省 不 不, 數 (1) 數, 不 數 * 料 * 數 int *int_ptr; char *ch_ptr; float *float_ptr; double *double_ptr; 數 (2) int i=3; int *ptr; ptr=&i; 1000 1012 ptr 數, 數 1004

More information

C++ 程序设计 OJ4 - 参考答案 MASTER 2019 年 5 月 30 日 1

C++ 程序设计 OJ4 - 参考答案 MASTER 2019 年 5 月 30 日 1 C++ 程序设计 OJ4 - 参考答案 MASTER 2019 年 月 30 日 1 1 STRINGSORT 1 StringSort 题目描述 编写程序, 利用 string 类完成一个字符串中字符的排序 ( 降序 ) 并输出 输入描述 输入仅一行, 是一个仅由大小写字母和数字组成的字符串 输出描述 输出排序后的字符串 样例输入 abcde 样例输出 edcba 提示 使用 std::sort

More information

1 2005 9 2005,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : 100081 : : 7871092 1 /16 : 8. 75 : 96 : 2005 11 1 : 2005 11 1 : ISBN 7

1 2005 9 2005,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : 100081 : : 7871092 1 /16 : 8. 75 : 96 : 2005 11 1 : 2005 11 1 : ISBN 7 1 2005 9 2005,,,,,,,,,, ( http: \ \ www. ncre. cn,, ) 30,,,,,,,, C : C : : 19 : 100081 : : 7871092 1 /16 : 8. 75 : 96 : 2005 11 1 : 2005 11 1 : ISBN 7-80097 - 564-9 /TP 8 : 10. 00 ,,,, 1994 NCRE,,, ( ),,,,,

More information

Chapter12 Derived Classes

Chapter12   Derived Classes 继 承 -- 派 生 类 复 习 1. 有 下 面 类 的 说 明, 有 错 误 的 语 句 是 : class X { A) const int a; B) X(); C) X(int val) {a=2 D) ~X(); 答 案 :C 不 正 确, 应 改 成 X(int val) : a(2) { 2. 下 列 静 态 数 据 成 员 的 特 性 中, 错 误 的 是 A) 说 明 静 态 数

More information

untitled

untitled 1 7 7.1 7.2 7.3 7.4 7.5 2 7.1 VFT virtual 7.1 3 1 1. 2. public protected public 3. VFT 4. this const volatile 4 2 5. ( ) ( ) 7.1 6. no-static virtual 7.2 7. inline 7.3 5 3 8. this this 9. ( ) ( ) delete

More information

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File

1 Project New Project 1 2 Windows 1 3 N C test Windows uv2 KEIL uvision2 1 2 New Project Ateml AT89C AT89C51 3 KEIL Demo C C File 51 C 51 51 C C C C C C * 2003-3-30 pnzwzw@163.com C C C C KEIL uvision2 MCS51 PLM C VC++ 51 KEIL51 KEIL51 KEIL51 KEIL 2K DEMO C KEIL KEIL51 P 1 1 1 1-1 - 1 Project New Project 1 2 Windows 1 3 N C test

More information

第7章-并行计算.ppt

第7章-并行计算.ppt EFEP90 10CDMP3 CD t 0 t 0 To pull a bigger wagon, it is easier to add more oxen than to grow a gigantic ox 10t 0 t 0 n p Ts Tp if E(n, p) < 1 p, then T (n) < T (n, p) s p S(n,p) = p : f(x)=sin(cos(x))

More information

Microsoft PowerPoint - string_kruse [兼容模式]

Microsoft PowerPoint - string_kruse [兼容模式] Strings Strings in C not encapsulated Every C-string has type char *. Hence, a C-string references an address in memory, the first of a contiguous set of bytes that store the characters making up the string.

More information

ebook39-6

ebook39-6 6 first-in-first-out, FIFO L i n e a r L i s t 3-1 C h a i n 3-8 5. 5. 3 F I F O L I F O 5. 5. 6 5. 5. 6.1 [ ] q u e n e ( r e a r ) ( f r o n t 6-1a A 6-1b 6-1b D C D 6-1c a) b) c) 6-1 F I F O L I F ADT

More information

e bug 0 x=0 y=5/x 0 Return 4 2

e bug 0 x=0 y=5/x 0 Return 4 2 e 1 4 1 4 4.1 4.2 4.3 4.4 4.5 e 2 4.1 bug 0 x=0 y=5/x 0 Return 4 2 e 3 4 3 e 4 (true) (false) 4 4 e 5 4 5 4.2 1 G= V E V={n1,n2,,n m } E={e1,e2,,e p } e k ={n i,n j }, n i,n j V e 6 4.2 4 6 1 e 3 n 1 e

More information

摘 要 就 一 个 游 戏 而 言, 对 于 参 与 者, 需 要 研 究 不 同 的 策 略 去 达 到 胜 利, 而 对 于 游 戏 设 计 者, 则 需 要 研 究 这 个 游 戏 的 平 衡 性 与 记 分 规 则 的 合 理 性, 并 不 断 去 调 整 它 们 在 本 文 中, 我 们

摘 要 就 一 个 游 戏 而 言, 对 于 参 与 者, 需 要 研 究 不 同 的 策 略 去 达 到 胜 利, 而 对 于 游 戏 设 计 者, 则 需 要 研 究 这 个 游 戏 的 平 衡 性 与 记 分 规 则 的 合 理 性, 并 不 断 去 调 整 它 们 在 本 文 中, 我 们 三 国 杀 游 戏 平 衡 性 与 记 分 规 则 合 理 性 分 析 报 告 摘 要 就 一 个 游 戏 而 言, 对 于 参 与 者, 需 要 研 究 不 同 的 策 略 去 达 到 胜 利, 而 对 于 游 戏 设 计 者, 则 需 要 研 究 这 个 游 戏 的 平 衡 性 与 记 分 规 则 的 合 理 性, 并 不 断 去 调 整 它 们 在 本 文 中, 我 们 将 站 在 游 戏 设

More information

立 志 于 打 造 最 贴 近 考 生 实 际 的 辅 导 书 计 算 机 考 研 之 数 据 结 构 高 分 笔 记 率 辉 编 著 周 伟 张 浩 审 核 讨 论 群 :15945769

立 志 于 打 造 最 贴 近 考 生 实 际 的 辅 导 书 计 算 机 考 研 之 数 据 结 构 高 分 笔 记 率 辉 编 著 周 伟 张 浩 审 核 讨 论 群 :15945769 立 志 于 打 造 最 贴 近 考 生 实 际 的 辅 导 书 计 算 机 考 研 之 数 据 结 构 高 分 笔 记 率 辉 编 著 周 伟 张 浩 审 核 讨 论 群 :15945769 前 言 在 计 算 机 统 考 的 四 门 专 业 课 中, 最 难 拿 高 分 的 就 是 数 据 结 构 但 是 这 门 课 本 身 的 难 度 并 不 是 考 生 最 大 的 障 碍, 真 正 的 障 碍

More information

Ps22Pdf

Ps22Pdf C ( CIP) C /. :, 2001. 7 21 ISBN 7-5624 -2355-5. C........ C. TP312 CIP ( 2001 ) 034496 C * * : 7871092 1 /16 : 14. 25 : 356 20017 1 20017 1 : 1 6 000 ISBN 7-5624-2355-5 / TP311 : 21. 00 C, C,,,, C,, (

More information

全国计算机技术与软件专业技术资格(水平)考试

全国计算机技术与软件专业技术资格(水平)考试 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 ) 考 试 2009 年 下 半 年 程 序 员 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 ) 请 按 下 述 要 求 正 确 填 写 答 题 纸 1. 在 答 题 纸 的 指 定 位 置 填 写 你 所 在 的 省 自 治 区 直 辖 市 计 划 单 列 市 的 名 称 2. 在 答

More information

Generated by Unregistered Batch DOC TO PDF Converter , please register! 浙江大学 C 程序设计及实验 试题卷 学年春季学期考试时间 : 2003 年 6 月 20 日上午 8:3

Generated by Unregistered Batch DOC TO PDF Converter , please register! 浙江大学 C 程序设计及实验 试题卷 学年春季学期考试时间 : 2003 年 6 月 20 日上午 8:3 浙江大学 C 程序设计及实验 试题卷 2002-2003 学年春季学期考试时间 : 2003 年 6 月 20 日上午 8:30-10:30 注意 : 答题内容必须写在答题卷上, 写在本试题卷上无效 一. 单项选择题 ( 每题 1 分, 共 10 分 ) 1. 下列运算符中, 优先级最低的是 A.

More information

概述

概述 OPC Version 1.6 build 0910 KOSRDK Knight OPC Server Rapid Development Toolkits Knight Workgroup, eehoo Technology 2002-9 OPC 1...4 2 API...5 2.1...5 2.2...5 2.2.1 KOS_Init...5 2.2.2 KOS_InitB...5 2.2.3

More information

Microsoft Word - 01.DOC

Microsoft Word - 01.DOC 第 1 章 JavaScript 简 介 JavaScript 是 NetScape 公 司 为 Navigator 浏 览 器 开 发 的, 是 写 在 HTML 文 件 中 的 一 种 脚 本 语 言, 能 实 现 网 页 内 容 的 交 互 显 示 当 用 户 在 客 户 端 显 示 该 网 页 时, 浏 览 器 就 会 执 行 JavaScript 程 序, 用 户 通 过 交 互 式 的

More information

全国计算机技术与软件专业技术资格(水平)考试

全国计算机技术与软件专业技术资格(水平)考试 全 国 计 算 机 技 术 与 软 件 专 业 技 术 资 格 ( 水 平 ) 考 试 2008 年 上 半 年 程 序 员 下 午 试 卷 ( 考 试 时 间 14:00~16:30 共 150 分 钟 ) 试 题 一 ( 共 15 分 ) 阅 读 以 下 说 明 和 流 程 图, 填 补 流 程 图 中 的 空 缺 (1)~(9), 将 解 答 填 入 答 题 纸 的 对 应 栏 内 [ 说 明

More information

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2

Python a p p l e b e a r c Fruit Animal a p p l e b e a r c 2-2 Chapter 02 變數與運算式 2.1 2.1.1 2.1.2 2.1.3 2.1.4 2.2 2.2.1 2.2.2 2.2.3 type 2.2.4 2.3 2.3.1 print 2.3.2 input 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 + 2.4.6 Python Python 2.1 2.1.1 a p p l e b e a r c 65438790

More information

Microsoft PowerPoint - 4. 数组和字符串Arrays and Strings.ppt [兼容模式]

Microsoft PowerPoint - 4. 数组和字符串Arrays and Strings.ppt [兼容模式] Arrays and Strings 存储同类型的多个元素 Store multi elements of the same type 数组 (array) 存储固定数目的同类型元素 如整型数组存储的是一组整数, 字符数组存储的是一组字符 数组的大小称为数组的尺度 (dimension). 定义格式 : type arrayname[dimension]; 如声明 4 个元素的整型数组 :intarr[4];

More information

NOWOER.OM m/n m/=n m/n m%=n m%n m%=n m%n m/=n 4. enum string x1, x2, x3=10, x4, x5, x; 函数外部问 x 等于什么? 随机值 5. unsigned char *p1; unsigned long *p

NOWOER.OM m/n m/=n m/n m%=n m%n m%=n m%n m/=n 4. enum string x1, x2, x3=10, x4, x5, x; 函数外部问 x 等于什么? 随机值 5. unsigned char *p1; unsigned long *p NOWOER.OM /++ 程师能 评估. 单项选择题 1. 下 描述正确的是 int *p1 = new int[10]; int *p2 = new int[10](); p1 和 p2 申请的空间 的值都是随机值 p1 和 p2 申请的空间 的值都已经初始化 p1 申请的空间 的值是随机值,p2 申请的空间 的值已经初始化 p1 申请的空间 的值已经初始化,p2 申请的空间 的值是随机值 2.

More information

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.07.doc

Microsoft Word - 把时间当作朋友(2011第3版)3.0.b.07.doc 2 5 8 11 0 1. 13 2. 15 3. 18 1 1. 22 2. 25 3. 27 2 1. 35 2. 38 3. 41 4. 43 5. 48 6. 50 3 1. 56 2. 59 3. 63 4. 65 5. 69 13 22 35 56 6. 74 7. 82 8. 84 9. 87 10. 97 11. 102 12. 107 13. 111 4 114 1. 114 2.

More information

BOOL EnumWindows(WNDENUMPROC lparam); lpenumfunc, LPARAM (Native Interface) PowerBuilder PowerBuilder PBNI 2

BOOL EnumWindows(WNDENUMPROC lparam); lpenumfunc, LPARAM (Native Interface) PowerBuilder PowerBuilder PBNI 2 PowerBuilder 9 PowerBuilder Native Interface(PBNI) PowerBuilder 9 PowerBuilder C++ Java PowerBuilder 9 PBNI PowerBuilder Java C++ PowerBuilder NVO / PowerBuilder C/C++ PowerBuilder 9.0 PowerBuilder Native

More information

Microsoft Word - 970617cppFinalSolution.doc

Microsoft Word - 970617cppFinalSolution.doc 國 立 台 灣 海 洋 大 學 資 訊 工 程 系 C++ 程 式 設 計 期 末 考 參 考 答 案 姓 名 : 系 級 : 學 號 : 97/06/17 考 試 時 間 :10:00 12:10 試 題 敘 述 蠻 多 的, 看 清 楚 題 目 問 什 麼, 針 對 重 點 回 答 是 很 重 要 的 ; 不 確 定 的 請 一 定 要 當 場 提 出 來, 不 要 白 花 力 氣 在 誤 會

More information

Microsoft Word - 2008年9月二级C真卷.doc

Microsoft Word - 2008年9月二级C真卷.doc 机 密 启 用 前 2008 年 9 月 全 国 计 算 机 等 级 考 试 二 级 笔 试 试 卷 C 语 言 程 序 设 计 24 注 意 事 项 一 考 生 应 严 格 遵 守 考 场 规 则, 得 到 监 考 人 员 指 令 后 方 可 作 答 二 考 生 拿 到 试 卷 后 应 首 先 将 自 己 的 姓 名 准 考 证 号 等 内 容 涂 写 在 答 题 卡 的 相 应 位 置 上 三

More information

2015年计算机二级(C语言)模拟试题及答案(四)

2015年计算机二级(C语言)模拟试题及答案(四) 2016 年 计 算 机 二 级 (C 语 言 ) 模 拟 试 题 及 答 案 (4) 一 填 空 题 1 C 语 言 中 基 本 的 数 据 类 型 有 : 2 C 语 言 中 普 通 整 型 变 量 的 类 型 说 明 符 为, 在 内 存 中 占 字 节, 有 符 号 普 通 整 型 的 数 据 范 围 是 3 整 数 -35 在 机 内 的 补 码 表 示 为 4 执 行 下 列 语 句 int

More information

3. 給 定 一 整 數 陣 列 a[0] a[1] a[99] 且 a[k]=3k+1, 以 value=100 呼 叫 以 下 兩 函 式, 假 設 函 式 f1 及 f2 之 while 迴 圈 主 體 分 別 執 行 n1 與 n2 次 (i.e, 計 算 if 敘 述 執 行 次 數, 不

3. 給 定 一 整 數 陣 列 a[0] a[1] a[99] 且 a[k]=3k+1, 以 value=100 呼 叫 以 下 兩 函 式, 假 設 函 式 f1 及 f2 之 while 迴 圈 主 體 分 別 執 行 n1 與 n2 次 (i.e, 計 算 if 敘 述 執 行 次 數, 不 1. 右 側 程 式 正 確 的 輸 出 應 該 如 下 : * *** ***** ******* ********* 在 不 修 改 右 側 程 式 之 第 4 行 及 第 7 行 程 式 碼 的 前 提 下, 最 少 需 修 改 幾 行 程 式 碼 以 得 到 正 確 輸 出? (A) 1 (B) 2 (C) 3 (D) 4 1 int k = 4; 2 int m = 1; 3 for (int

More information

untitled

untitled 1 5 IBM Intel 1. IBM 第 1/175 页 第 2/175 页 第 3/175 页 80 第 4/175 页 2. IBM 第 5/175 页 3. (1) 第 6/175 页 第 7/175 页 第 8/175 页 = = 第 9/175 页 = = = = = 第 10/175 页 = = = = = = = = 3. (2) 第 11/175 页 第 12/175 页 第 13/175

More information

51 C 51 isp 10 C PCB C C C C KEIL

51 C 51 isp 10   C   PCB C C C C KEIL http://wwwispdowncom 51 C " + + " 51 AT89S51 In-System-Programming ISP 10 io 244 CPLD ATMEL PIC CPLD/FPGA ARM9 ISP http://wwwispdowncom/showoneproductasp?productid=15 51 C C C C C ispdown http://wwwispdowncom

More information

(6) 要 求 付 款 管 理 员 从 预 订 表 中 查 询 距 预 订 的 会 议 时 间 两 周 内 的 预 定, 根 据 客 户 记 录 给 满 足 条 件 的 客 户 发 送 支 付 余 款 要 求 (7) 支 付 余 款 管 理 员 收 到 客 户 余 款 支 付 的 通 知 后, 检

(6) 要 求 付 款 管 理 员 从 预 订 表 中 查 询 距 预 订 的 会 议 时 间 两 周 内 的 预 定, 根 据 客 户 记 录 给 满 足 条 件 的 客 户 发 送 支 付 余 款 要 求 (7) 支 付 余 款 管 理 员 收 到 客 户 余 款 支 付 的 通 知 后, 检 2016 年 上 半 年 软 件 设 计 师 考 试 真 题 ( 下 午 题 ) 下 午 试 题 试 题 一 ( 共 15 分 ) 阅 读 下 列 说 明 和 图, 回 答 问 题 1 至 问 题 4, 将 解 答 填 入 答 题 纸 的 对 应 栏 内 说 明 某 会 议 中 心 提 供 举 办 会 议 的 场 地 设 施 和 各 种 设 备, 供 公 司 与 各 类 组 织 机 构 租 用 场

More information

Ps22Pdf

Ps22Pdf ( 98 ) C ( ) ( )158 1998 C : C C C,,, C,, : C ( ) : : (, 100084) : : : 7871092 1/ 16 :18 25 :415 : 2000 3 1 2000 3 1 : ISBN 7 302 01166 4/ T P432 : 00016000 : 22 00 ( 98 ) 20 90,,, ;,,, 1994, 1998, 160,

More information

3.1 num = 3 ch = 'C' 2

3.1 num = 3 ch = 'C' 2 Java 1 3.1 num = 3 ch = 'C' 2 final 3.1 final : final final double PI=3.1415926; 3 3.2 4 int 3.2 (long int) (int) (short int) (byte) short sum; // sum 5 3.2 Java int long num=32967359818l; C:\java\app3_2.java:6:

More information

Strings

Strings Inheritance Cheng-Chin Chiang Relationships among Classes A 類 別 使 用 B 類 別 學 生 使 用 手 機 傳 遞 訊 息 公 司 使 用 金 庫 儲 存 重 要 文 件 人 類 使 用 交 通 工 具 旅 行 A 類 別 中 有 B 類 別 汽 車 有 輪 子 三 角 形 有 三 個 頂 點 電 腦 內 有 中 央 處 理 單 元 A

More information

《计算概论》课程 第十九讲 C 程序设计语言应用

《计算概论》课程 第十九讲  C 程序设计语言应用 计算概论 A 程序设计部分 字符数组与字符串 李戈 北京大学信息科学技术学院软件研究所 lige@sei.pku.edu.cn 字符数组的定义 #include int main() char a[10] = 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j' ; for (int i = 0; i < 10; i++) cout

More information

untitled

untitled (encapsulation) 例 類 說 類 料 來 料 information hiding 念 (inheritance) 來說 類 類 類 類 類 類 行 利 來 (polymorphism) 不 類 數 不 1 2 3 4 類 類 不 類 不 類 5 6 7 // virtual 不見了 #include #include using namespace

More information

Microsoft Word - ch04三校.doc

Microsoft Word - ch04三校.doc 4-1 4-1-1 (Object) (State) (Behavior) ( ) ( ) ( method) ( properties) ( functions) 4-2 4-1-2 (Message) ( ) ( ) ( ) A B A ( ) ( ) ( YourCar) ( changegear) ( lowergear) 4-1-3 (Class) (Blueprint) 4-3 changegear

More information

download.kaoyan.com_2006ÄêÌì½ò¹¤Òµ´óѧ¸ß¼¶ÓïÑÔ³ÌÐòÉè¼Æ£¨409£©¿¼ÑÐÊÔÌâ

download.kaoyan.com_2006ÄêÌì½ò¹¤Òµ´óѧ¸ß¼¶ÓïÑÔ³ÌÐòÉè¼Æ£¨409£©¿¼ÑÐÊÔÌâ 考生注意 : 本试卷共七大题, 满分 150 分 考试时间为 3 小时 ; 所有答案均写在答题纸上 ( 注明题号 ), 在此答题一律无效无效 一 选择题 ( 本题共 20 小题, 每小题 2 分, 满分 40 分 ) 1 char ch 1 2 A 0

More information

epub 33-8

epub 33-8 8 1) 2) 3) A S C I I 4 C I / O I / 8.1 8.1.1 1. ANSI C F I L E s t d i o. h typedef struct i n t _ f d ; i n t _ c l e f t ; i n t _ m o d e ; c h a r *_ n e x t ; char *_buff; /* /* /* /* /* 1 5 4 C FILE

More information

提问袁小兵:

提问袁小兵: C++ 面 试 试 题 汇 总 柯 贤 富 管 理 软 件 需 求 分 析 篇 1. STL 类 模 板 标 准 库 中 容 器 和 算 法 这 部 分 一 般 称 为 标 准 模 板 库 2. 为 什 么 定 义 虚 的 析 构 函 数? 避 免 内 存 问 题, 当 你 可 能 通 过 基 类 指 针 删 除 派 生 类 对 象 时 必 须 保 证 基 类 析 构 函 数 为 虚 函 数 3.

More information

untitled

untitled 1 Outline 料 類 說 Tang, Shih-Hsuan 2006/07/26 ~ 2006/09/02 六 PM 7:00 ~ 9:30 聯 ives.net@gmail.com www.csie.ntu.edu.tw/~r93057/aspnet134 度 C# 力 度 C# Web SQL 料 DataGrid DataList 參 ASP.NET 1.0 C# 例 ASP.NET 立

More information

達文西密碼

達文西密碼 THE DA VINCI CODE 立 年 年 黎 了 切 利 度 羅 來 了 說 了 行 行 紐 了 黎 羅 羅 廊 賈 索 見 離 拉 老 金 力 拉 了 來 索 不 料 了 廊 了 了 了 了 來 洞 不 來 不 裡 若 欄 裡 欄 了 不 不 裡 裡 了 說 不 說 什 說 了 不 不 1 了 了 索 連 不 索 了 說 切 練 了 不 說 了 不 了 了 了 不 老 索 說 了 立 識 了

More information

第二章 簡介類別

第二章  簡介類別 Instructor Hsueh-Wen Tseng 曾學文,hwtseng@nchu.edu.tw Textbook C++ 程式設計風格與藝術 (O Reilly). Requirements Assignment x? 100% TAs 第一章概觀 C++ 1-2 二種版本的 C++ 1-5 初步檢視類別 1-1 何謂物件導向程式設計 1-8 C++ 的關鍵字 1-2 二種版本的 C++ //

More information

2

2 C++ 2007 11 2 Contents 1 1 1.1..................................... 1 1.2................................... 1 1.3........................... 1 1.4........................................ 1 1.5.....................................

More information

bingdian001.com

bingdian001.com 7 8 4 3. cos f ( ) a b,, ( A) ab B ab ( C) ab D ab A cos lm lm, f ( ) a a a b ab. a A. f ( ) ' ( A) f () f ( ) B f () f ( ) ( C ) f () f ( ) D f () f ( ) f ( ) f ( ) C f ( ) f f ( ) f ' ( ), () ( ) ()

More information

Microsoft Word - 实用案例.doc

Microsoft Word - 实用案例.doc 计 算 机 系 统 应 用 2009 年 第 12 期 嵌 入 式 Linux 下 温 湿 度 传 感 器 的 设 计 与 实 现 1 Design and Implementation of Temperature and Humidity Sensor Based on Embedded Linux 陈 博 刘 锦 高 ( 华 东 师 范 大 学 电 子 科 学 技 术 系 上 海 200241)

More information

untitled

untitled 1 Outline 流 ( ) 流 ( ) 流 ( ) 流 ( ) 流 ( ) 狀 流 ( ) 利 來 行流 if () 立 行 ; else 不 立 行 ; 例 sample2-a1 (1) 列 // 料 Console.Write(""); string name = Console.ReadLine(); Console.WriteLine(" " + name + "!!"); 例 sample2-a1

More information

程序员-下午题-10下

程序员-下午题-10下 全国计算机技术与软件专业技术资格 ( 水平 ) 考试 2010 年下半年程序员下午试卷 ( 考试时间 14:00~16:30 共 150 分钟 ) 请按下述要求正确填写答题纸 1. 在答题纸的指定位置填写你所在的省 自治区 直辖市 计划单列市的名称 2. 在答题纸的指定位置填写准考证号 出生年月日和姓名 3. 答题纸上除填写上述内容外只能写解答 4. 本试卷共 6 道题, 试题一至试题四是必答题,

More information

Microsoft PowerPoint - ds-9.ppt [兼容模式]

Microsoft PowerPoint - ds-9.ppt [兼容模式] 第 九 章 静 态 表 动 态 表 哈 希 表 9.1 基 本 概 念 (Page 214) 2 表 : 是 由 同 一 类 型 元 素 成 的 集 合 静 态 表 : 只 做 询 或 检 索 操 作 动 态 表 : 询 检 索 插 入 删 除 关 键 字 : 是 元 素 中 某 个 相 的 值, 用 它 可 以 标 识 一 个 元 素 主 关 键 字 次 关 键 字 : 根 给 定 值, 在 表

More information

《C语言程序设计》教材习题参考答案

《C语言程序设计》教材习题参考答案 教材名称 : C 语言程序设计 ( 第 1 版 ) 黄保和 江弋编著清华大学出版社 ISBN:978-7-302-13599-9, 红色封面 答案制作时间 :2011 年 2 月 -5 月 一 选择题 1. 设已定义 int a, * p, 下列赋值表达式中正确的是 :C)p=&a 2. 设已定义 int x,*p=&x;, 则下列表达式中错误的是 :B)&*x 3. 若已定义 int a=1,*b=&a;,

More information

javaexample-02.pdf

javaexample-02.pdf n e w. s t a t i c s t a t i c 3 1 3 2 p u b l i c p r i v a t e p r o t e c t e d j a v a. l a n g. O b j e c t O b j e c t Rect R e c t x 1 y 1 x 2 y 2 R e c t t o S t r i n g ( ) j a v a. l a n g. O

More information

提纲 1 2 OS Examples for 3

提纲 1 2 OS Examples for 3 第 4 章 Threads2( 线程 2) 中国科学技术大学计算机学院 October 28, 2009 提纲 1 2 OS Examples for 3 Outline 1 2 OS Examples for 3 Windows XP Threads I An Windows XP application runs as a seperate process, and each process may

More information

C, Win-TC Turbo C,, C, C,,,, C C, : Win-TC C, 23,,, 15,, C Turbo C Win-TC Turbo C,,,, 2005 1 W in -TC 1 Win-TC 1 1. Win-TC 1 2. Win-TC 1 3. Win-TC 1 2 Win-TC 3 1. 3 2. 3 3. 4 4. 4 5. 4 6. 4 7. 5 8. 5 9.

More information

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40

C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 C C trio@seu.edu.cn C C C C The Most Beautiful Language and Most Dangerous Language in the Programming World! C 2 C C C 4 C 40 30 10 Project 30 C Project 3 60 Project 40 Week3 C Week5 Week5 Memory & Pointer

More information

ebook15-C

ebook15-C C 1 1.1 l s ( 1 ) - i i 4. 14 - d $ l s -ldi /etc/. /etc/.. - i i 3077 drwxr-sr-x 7 bin 2048 Aug 5 20:12 /etc/./ 2 drwxr-xr-x 13 root 512 Aug 5 20:11 /etc/../ $ls -ldi /. /..... i 2 2 drwxr-xr-x 13 root

More information

Microsoft Word - xxds fy.doc

Microsoft Word - xxds  fy.doc , 5, ;,,,,,, ; ; 4,,, ; () 1345, 2,,,,,,,, 2014 2 1 1 11 1 111 1 112 2 113 Cramer 3 12 3 121 3 122 4 123 4 13 5 131 5 132 13 133 13 134 Cramer 14 135 16 14 17 15 20 16 () 27 2 30 21 31 211 31 212 31 213

More information

四川省教育厅

四川省教育厅 四 川 省 教 育 厅 四 川 省 体 育 局 川 教 函 2015 727 号 四 川 省 教 育 厅 四 川 省 体 育 局 关 于 举 办 2016 年 四 川 省 中 学 生 篮 球 比 赛 和 排 球 乒 乓 球 羽 毛 球 田 径 锦 标 赛 的 通 知 各 市 ( 州 ) 教 育 局 体 育 局 有 关 学 校 : 为 推 动 我 省 篮 球 排 球 乒 乓 球 运 动 的 发 展,

More information

9,, (CIP) /. :, ISBN T U767 CI P ( 2004 ) : 122 : / mail.whut.edu.c

9,, (CIP) /. :, ISBN T U767 CI P ( 2004 ) : 122 : /    mail.whut.edu.c 9,, (CIP) /. :, 2005.2 ISBN 7 5629 2097 4....T U767 CI P ( 2004 )003594 : 122 : 430070 http:/ / www.techbook.com.cn E-mail: yangxuezh@ mail.whut.edu.cn : : : 7871092 1/ 16 : 17 : 421 : 2005 2 1 : 2006

More information

1. 16 峯 2007 2008 16 峯 2

1. 16 峯 2007 2008 16 峯 2 PART I 1 1. 16 峯 2007 2008 16 峯 2 2. 16 峯 峯 --- 16-15,000 52% 236741 1 L 3 3. 16 峯 15,000 52% 230287 1L 4 - 5 5. 20 1976 20 6 6. 23C927 7 7. 238529 8 232709 9 9. 2354A5 10 10. 2000 237707 0.7L 58 11 11.

More information

《C语言程序设计》教材习题参考答案

《C语言程序设计》教材习题参考答案 教材名称 : C 语言程序设计 ( 第 1 版 ) 黄保和 江弋编著清华大学出版社 ISBN: 978-7-302-13599-9, 红色封面答案制作时间 :2011 年 2 月 -5 月一 选择题 1. 以下数组定义中, 错误的是 :C)int a[3]=1,2,3,4; 2. 以下数组定义中, 正确的是 :B) int a[][2]=1,2,3,4; 3. 设有定义 int a[8][10];,

More information