poj 1218 THE DRUNK JAILER

来源:互联网 发布:数据库远程连接错误26 编辑:程序博客网 时间:2024/05/21 06:21
#include "iostream"#include "memory.h"using namespace std;int cell[110];int main(){    int tc, num, i, j, ans;    cin >> tc;    while (tc--)    {          memset(cell, 0, sizeof(cell));          ans = 0;          cin >> num;          for (i = 1; i <= num; i++)             for (j = 1; j <= num; j++)             {                 if (j % i == 0)                 {                    if (cell[j] == 0)                        cell[j] = 1;                    else                        cell[j] = 0;                 }             }          for (i = 1; i <= num; i++)             if (cell[i] == 1)                ans++;          cout << ans << endl;    }        system("pause");}

原创粉丝点击