Skip to content

Instantly share code, notes, and snippets.

@completejavascript
Created September 15, 2018 10:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save completejavascript/ca409c5e279a07d1d53c983700392a4e to your computer and use it in GitHub Desktop.
Save completejavascript/ca409c5e279a07d1d53c983700392a4e to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
typedef unsigned long long ull;
int main()
{
//freopen("input.txt","r",stdin);
ios::sync_with_stdio(false);
int Testcase, n;
cin >> Testcase;
for(int tc = 0; tc < Testcase; tc++)
{
cin >> n;
ull count5 = 0, temp = 5;
while(true)
{
ull t = n / temp;
if(t == 0) break;
count5 += t;
temp *= 5;
}
cout << count5 << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment